Skip to content

fix: partition Evo-derived caches by chainstate view - #8238

Closed
PastaPastaPasta wants to merge 1 commit into
dashpay:developfrom
PastaPastaPasta:fix/evo-view-caches
Closed

PastaPastaPasta wants to merge 1 commit into
dashpay:developfrom
PastaPastaPasta:fix/evo-view-caches

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

The Evo-derived caches (masternode lists, quorums, quorum snapshots, the credit pool, EHF signals, mined commitments, versionbits) are keyed by block only. While an AssumeUTXO snapshot chainstate and the background chainstate run together, an entry one chainstate warmed is served to the other, although the two read different EvoDB state for the same block.

AssumeUTXO stack (merge in this order; each PR holds the commits of the ones below it): #8238 → #7887 → #8270 → #7593 → #8271 → #7601 → #8272 → #8078 → #8273 → #8079 → #8276. #8237 is merged (31bd776cf8), and the stack is rebased onto develop ea87bfbe50 (with #8263 and #8262), so #8238 is the bottom layer. Review only the commits listed as new in each PR.

New on top of develop: one commit, 064100a733 fix(evo): partition Evo-derived caches by view. With no snapshot loaded it changes no behaviour. EvoViewToken::AtOrBelowSnapshotBase() names the heights at which a snapshot view holds only carried state, and ReadBlockInView() reads a block body for a view (raising BlockDataUnavailableError where the snapshot view lacks it); every check of that kind in this PR uses them.

What was done?

  • Partitioned per view, because at and below the snapshot base their values come from carried, not yet validated state, and the background chainstate reads the same block hashes: the masternode lists, diffs and tip (CDeterministicMNManager::m_views); MNHF signals (mnhfCache); credit pools (creditPoolCache); versionbits (EvoViewVersionBitsCache, for the EHF deployments); the mined-commitment location and qc-hash caches, including the active quorum set that perf: derive the active quorum set from the previous block's set #8263 derives from the previous block's (CQuorumBlockProcessor); the quorum manager's quorum and scan caches (CQuorumManager::m_view_caches); quorum snapshots (quorumSnapshotCache); quorum members (members_by_view, indexed_members_by_view in llmq/utils.cpp); and the previous-coinbase ChainLock slot (cached_by_view in CheckCbTxBestChainlock), because a snapshot block must be validated with the same view's coinbase knowledge its template was built from.
  • Shared, as on develop, because the background chainstate cannot reach a snapshot-derived value through them: m_warningcache, the quorum proof caches and the quorum-data cleanup cache. They are filled only under the active view, a rejected snapshot shuts the node down, and a promoted one has been validated. Caches of data parsed from block bytes stay shared too.
  • The caches are keyed by view (EvoViewCache). Retiring a generation drops only that generation's partitions, so NORMAL keeps its own and its masternode-list tip; opening a CEvoDB and promotion still drop every partition.
  • Pre-base unavailability. A snapshot chainstate has no Evo or LLMQ history at or below its base. Under a snapshot view whose base is at or past DIP3, a read whose answer depends on that history throws BlockDataUnavailableError, a local error that fails the block without marking it invalid (fix: treat missing or unreadable local Evo state as an error, not invalidity #8235). There is one gate per path class: commitments by hash (HasMinedCommitment), height-index scans (RequireSatisfiedScan, which covers ScanQuorums/ScanCommitments and their users), and block bodies. A short scan of an LLMQ type that was not enabled up to the base is complete, not missing.
  • A view's masternode-list cache is pruned against the higher of its tip and the highest block it processed and has not undone, because a view that is not active never learns a tip.
  • A quorum scan is cached only when its start block is on the chain of the usable chainstate with the view's Evo identity (ChainstateManager::EvoChain).
  • The chainman overloads of DeploymentActiveAfter/At decide buried deployments by height alone, as the params overloads already did.
  • Test hooks: CDeterministicMNManager::SetListSnapshotMissHookForTesting and CachedListHeightsForTesting.

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).

Tests: evo_db_tests/credit_pool_carried_at_the_snapshot_base_is_not_served_to_the_background (fails with a hash-only credit-pool cache in both directions: the snapshot lookup gets the background's pool, and the background lookup the carried one); caches warmed under the snapshot view are never served to NORMAL (chainstatemanager_activate_snapshot); view_cache_serves_live_views_of_its_evodb and view_cache_lookup_excludes_retirement (a cache refuses another CEvoDB's view and a retired generation's); chainstatemanager_mined_commitment_is_chain_aware extended for the by-hash and scan gates; chainstatemanager_stall_after_mn_list_evicts_it; chainstatemanager_rejection_mid_connect_activates_background; chainstatemanager_rejection_after_disconnect (without the disconnect-pool clear in #8237 it aborts on queuedTx.empty()); and evo_db_tests/retiring_a_generation_keeps_the_active_tip_list.

Breaking Changes

None with a single chainstate.

Checklist:

  • I have performed a self-review of my own code
  • I have added or updated relevant unit/integration/functional/e2e tests

🤖 Generated with Claude Code

@thepastaclaw

thepastaclaw commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit 064100a) · triage: normal

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 1 + Phase 2

This PR partitions Evo-derived caches by chainstate view and adds checks for history that an AssumeUTXO snapshot may not have. At this head, startup can reopen an existing snapshot, but only test code can import a new one. All completed code checks passed, including ClangFormat, lint, Cppcheck, the reported builds, and the no-wallet tests; the main Linux, sanitizer, and multiprocess tests and multiprocess lint were still pending.

🟡 9 suggestion(s) | 💬 1 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.

1 finding(s) not shown inline (the lines are not part of this PR's diff)

💬 Nitpick: The cache commit message describes an earlier scan guard that was never committed
Impact: A maintainer tracing a snapshot stall through history may look for an earlier unconditional RequireSatisfiedScan that does not exist in this stack.
<commit:0fe2776e39f>:1

The paragraph beginning “RequireSatisfiedScan treated any short height-index scan” reads as a description of the parent, but 28e3823d7d0 has no such helper. This commit introduces the guard and its enablement qualification together. Describe the rule this commit adds: a short scan does not need missing history if the quorum type could not have been enabled there.

source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)

Review provenance

Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The diff against develop includes an intricate storage migration in src/evo/evodb.cpp that uses a journal to promote snapshot-generation records into the normal EvoDB namespace and recover from interrupted promotion.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (lane 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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — dash-core-commit-history (completed, effort high); agent phase2-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/cbtx.cpp`:
- [SUGGESTION] src/evo/cbtx.cpp:210-221: A missing snapshot coinbase is treated as having no ChainLock
  Impact: With a post-V20 snapshot active, an unavailable base or work-block body can cause a caller to skip the previous-ChainLock constraint or derive a quorum modifier from the block hash instead.
  When validation reaches this check, it can skip the requirement to carry forward the previous coinbase's ChainLock instead of reporting that the previous coinbase is unavailable. `ConnectTip` opens a SNAPSHOT transaction, and `CheckCbTxBestChainlock` resolves it through `qman.CurrentView()`, but the disk helper checks only `EvoViewScope::InnermostAny()`. Production callers do not install that scope; the new test does. The resulting `nullopt` also sends `GetHashModifierFromWorkBlock` down the block-hash fallback. Pass the effective view through both call paths, distinguish a missing body from a read failure on a body marked present, and cover a SNAPSHOT transaction with no explicit scope.

In `src/instantsend/net_instantsend.cpp`:
- [SUGGESTION] src/instantsend/net_instantsend.cpp:436-439: Missing snapshot quorum history can terminate the InstantSend worker and node
  Impact: With a post-DIP3 snapshot active and InstantSend enabled, verification of a pending lock whose signing quorum is unavailable can terminate the process instead of deferring the lock.
  Missing local history can bring down the node before it finishes verifying a lock. A lock with a known cycle header can reach `BuildVerificationBatch`, but knowing that header does not mean the snapshot generation has the signing commitments. `SelectQuorumForSigning` calls `ScanQuorums`, and the non-rotating path calls `GetQuorum`; either can now throw `BlockDataUnavailableError`. No handler catches it before `util::TraceThread` rethrows it out of the `isman` thread entry point. Handle unavailability at the verification boundary, preserving the lock for retry without marking the lock or peer invalid, and exercise that path in a worker test.

In `src/validation.cpp`:
- [SUGGESTION] src/validation.cpp:3695-3708: Rolling back a background block evicts its masternode list from the wrong view
  Impact: During dual-chainstate validation, a background block that fails after deriving its masternode list can leave that uncommitted list available to NORMAL lookups.
  The NORMAL cache can still serve a candidate's list after its EvoDB transaction has been rolled back. `CDeterministicMNManager::ProcessBlock` caches the list before later checks in `ConnectBlock`, including transaction input validation. Both failure paths close the NORMAL transaction before calling `DiscardDeterministicMNBlock`, so `DiscardBlock` now resolves `View()` to the active SNAPSHOT default and erases from the wrong partition. Keep the rollback-before-eviction order, but capture the candidate's token while the transaction is open and use it for eviction. The existing eviction test uses the active chainstate, where the default happens to match; add the background case.

In `src/llmq/quorumsman.cpp`:
- [SUGGESTION] src/llmq/quorumsman.cpp:79-95: A quorum lookup that spans snapshot activation can cache data under the wrong view
  Impact: A transaction-less quorum request in flight during activation can return a quorum assembled from the old view and insert it into the new view's cache.
  A live cache token does not establish that the cached quorum came from that view. The `GetQuorum` overload used by callers such as the quorum RPC releases `cs_main` after the membership check; `BuildQuorumFromCommitment` then reads the commitment and members before resolving `CurrentView()` again for insertion. Activation can switch the default in that interval, so a result built under NORMAL can be stored under SNAPSHOT. `ScanMined` has the inverse problem: it captures the cache key early, but its commitment scan and build callbacks can resolve a different view. Bind one view and its chain at the outer lookup and keep that binding through reads and insertion, or abandon the result if the binding changes.

In `src/llmq/blockprocessor.cpp`:
- [SUGGESTION] src/llmq/blockprocessor.cpp:824-825: Missing an optional cache entry can make a complete quorum lookup fail
  Impact: A snapshot-view caller can receive an unavailable-history error even when the generation contains every commitment the caller requested.
  The scan can throw before returning a complete signing set. On a cache miss, or with caching disabled, `ScanMined` raises the target to at least `keepOldConnections`. For non-rotating `LLMQ_TEST`, a request for the two active signing commitments becomes a scan for three. If the generation contains two and older history is unavailable, this check throws before `ScanMined` can return the requested two. Keep the required count separate from the prefetch target, or disable speculative overfetch for partial-history views. Test a scan that meets the requested count but not the prefetch target.
- [SUGGESTION] src/llmq/blockprocessor.cpp:753-760: A quorum's first legal mining block can stall on history that cannot contain its commitment
  Impact: If a snapshot base is inside a DKG cycle but before its mining window, the commitment-count check can stall on the first block of that window even though the missing history cannot affect the count.
  A missing index entry is conclusive when the whole legal mining window is above the snapshot base. `GetNumCommitmentsRequired` calls `HasMinedCommitment` at the start of the window, but the new guard tests the quorum base height rather than the first height at which its commitment is legal. Derive the window using the same DKG cycle calculation as `IsMiningPhase`, accounting for the quorum-index offset in a rotating quorum's base height. Test a base between the cycle start and the first legal mining height.

In `src/evo/mnhftx.cpp`:
- [SUGGESTION] src/evo/mnhftx.cpp:317-323: Restart looks up the snapshot tip's EHF signals in the background database
  Impact: Restarting with a persisted post-V20 snapshot ahead of background validation can fail before the background chainstate gets a chance to resume.
  Startup can fail even when the snapshot generation already contains the tip's signal record. After `ActivateExistingSnapshot`, `CompleteChainstateInitialization` passes the snapshot's active tip to `ForceSignalDBUpdate`, but that function opens and commits a NORMAL transaction. `RebuildSignals` therefore misses the snapshot record, bypasses the snapshot-base guard added here, and can walk back to a block below `BLOCK_VALID_SCRIPTS` or to an unavailable body. If this is a legacy NORMAL-only migration, run it against the background tip; otherwise pass the tip's owning identity through both transaction calls. Cover a restart with distinct post-V20 tips.

In `src/evo/evodb.h`:
- [SUGGESTION] src/evo/evodb.h:349: A retired snapshot scope can access the replacement generation
  Impact: A caller that retains an `EvoViewScope` across retirement and replacement can read or modify the replacement generation even though its cache lookup rejects the same token.
  Direct database access and cache access disagree on whether the binding is valid. `ResolveView()` returns the scope's original token, but `GetCurrentIdentity()` strips its generation before `Read`, `Write`, and `GetCurTransaction` choose the currently bound SNAPSHOT context. `EvoViewCache::For` rejects that token through `WithLiveView`. Validate the resolved token under `CEvoDB::cs` before selecting the database context, rather than only at scope construction, and extend the retired-token test to cover direct access after binding a replacement.

In `src/evo/deterministicmns.h`:
- [SUGGESTION] src/evo/deterministicmns.h:841-865: The masternode manager exposes cache internals and a callback only tests use
  Impact: Every build exposes private cache state and a hook that runs caller-supplied code under the manager lock on a list miss.
  `SetListSnapshotMissHookForTesting`, `CachedListHeightsForTesting`, and `TipForTesting` add production API surface with no production callers, contrary to the project's convention against public test-only helpers. Keep the coverage, but assert the observable tip-list behavior where possible and move fault injection or cache-policy checks to a narrower test boundary.

In `<commit:0fe2776e39f>`:
- [NITPICK] <commit:0fe2776e39f>:1: The cache commit message describes an earlier scan guard that was never committed
  Impact: A maintainer tracing a snapshot stall through history may look for an earlier unconditional `RequireSatisfiedScan` that does not exist in this stack.
  The paragraph beginning “RequireSatisfiedScan treated any short height-index scan” reads as a description of the parent, but `28e3823d7d0` has no such helper. This commit introduces the guard and its enablement qualification together. Describe the rule this commit adds: a short scan does not need missing history if the quorum type could not have been enabled there.

Comment thread src/evo/cbtx.cpp Resolved
Comment thread src/instantsend/net_instantsend.cpp Resolved
Comment thread src/validation.cpp Resolved
Comment thread src/llmq/quorumsman.cpp
Comment on lines 90 to +95
auto quorum = std::make_shared<CQuorum>(llmq_params_opt.value(), blsWorker,
std::make_unique<CFinalCommitment>(std::move(qc)), pQuorumBaseBlockIndex, minedBlockHash, members);

const EvoViewToken view{m_evoDb.CurrentView()};
if (populate_cache && llmq_params_opt->size == 1) {
WITH_LOCK(m_cs_maps, mapQuorumsCache.insert(llmqType, quorumHash, quorum));
WITH_LOCK(m_cs_maps, m_view_caches.For(view).mapQuorumsCache.insert(llmqType, quorumHash, quorum));

@thepastaclaw thepastaclaw Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏭️ Deferred (maintainer decision; not blocking) at b638aa21; see the replies below.

🟡 Suggestion: A quorum lookup that spans snapshot activation can cache data under the wrong view
Impact: A transaction-less quorum request in flight during activation can return a quorum assembled from the old view and insert it into the new view's cache.

A live cache token does not establish that the cached quorum came from that view. The GetQuorum overload used by callers such as the quorum RPC releases cs_main after the membership check; BuildQuorumFromCommitment then reads the commitment and members before resolving CurrentView() again for insertion. Activation can switch the default in that interval, so a result built under NORMAL can be stored under SNAPSHOT. ScanMined has the inverse problem: it captures the cache key early, but its commitment scan and build callbacks can resolve a different view. Bind one view and its chain at the outer lookup and keep that binding through reads and insertion, or abandon the result if the binding changes.

source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferred (re-reviewed at b638aa21): BuildQuorumFromCommitment still reads the commitment and members before calling CurrentView() for insertion. I verified that #7887 binds the view around the calling operation, including RPC dispatch, so activation cannot switch the partition halfway through that lookup.

Comment on lines +824 to 825
if (ret.size() < maxCount) RequireSatisfiedScan(needs_missing_history, __func__, llmqType);
return ret;

@thepastaclaw thepastaclaw Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏭️ Deferred (maintainer decision; not blocking) at b638aa21; see the replies below.

🟡 Suggestion: Missing an optional cache entry can make a complete quorum lookup fail
Impact: A snapshot-view caller can receive an unavailable-history error even when the generation contains every commitment the caller requested.

The scan can throw before returning a complete signing set. On a cache miss, or with caching disabled, ScanMined raises the target to at least keepOldConnections. For non-rotating LLMQ_TEST, a request for the two active signing commitments becomes a scan for three. If the generation contains two and older history is unavailable, this check throws before ScanMined can return the requested two. Keep the required count separate from the prefetch target, or disable speculative overfetch for partial-history views. Test a scan that meets the requested count but not the prefetch target.

source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferred (re-reviewed at b638aa21): The short-scan check correctly enforces the count it receives; the problem is that ScanMined can inflate that count to keepOldConnections. In #8271 the SNAPSHOT branch passes nCountRequested to ProveScan, so optional cache warming no longer determines availability.

Comment on lines +753 to +760
} else if (LacksQuorumHistory(view, m_chainman.GetConsensus())) {
// A quorum based at or below the base may have been mined there, in
// history the view lacks: the miss does not mean it never was.
const CBlockIndex* quorum_base{m_chainman.m_blockman.LookupBlockIndex(quorumHash)};
if (quorum_base != nullptr && quorum_base->nHeight <= view.base_height) {
throw BlockDataUnavailableError(
strprintf("%s: commitment for quorum %s at or below the snapshot base is not available", __func__,
quorumHash.ToString()));

@thepastaclaw thepastaclaw Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏭️ Deferred (maintainer decision; not blocking) at b638aa21; see the replies below.

🟡 Suggestion: A quorum's first legal mining block can stall on history that cannot contain its commitment
Impact: If a snapshot base is inside a DKG cycle but before its mining window, the commitment-count check can stall on the first block of that window even though the missing history cannot affect the count.

A missing index entry is conclusive when the whole legal mining window is above the snapshot base. GetNumCommitmentsRequired calls HasMinedCommitment at the start of the window, but the new guard tests the quorum base height rather than the first height at which its commitment is legal. Derive the window using the same DKG cycle calculation as IsMiningPhase, accounting for the quorum-index offset in a rotating quorum's base height. Test a base between the cycle start and the first legal mining height.

source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferred (re-reviewed at b638aa21): A quorum base can precede the snapshot base even though its first mining window starts later, so height alone does not prove that a by-hash miss is unknown. For a seeded snapshot, #8271's ProvenNeverMined resolves this case from a complete sequence or from the quorum being newer than the oldest carried commitment, before the loader is introduced.

Comment thread src/evo/mnhftx.cpp Resolved
Comment thread src/evo/evodb.h Resolved
Comment on lines +841 to 865
/** Test-only hook invoked whenever a list lookup misses both the cache and
* the stored full lists, before diff-chain reconstruction. */
void SetListSnapshotMissHookForTesting(std::function<void(const CBlockIndex*)> hook) EXCLUSIVE_LOCKS_REQUIRED(!cs)
{
LOCK(cs);
m_list_snapshot_miss_hook = std::move(hook);
}

//! Heights of the lists cached for the current view.
std::vector<int> CachedListHeightsForTesting() EXCLUSIVE_LOCKS_REQUIRED(!cs)
{
LOCK(cs);
std::vector<int> heights;
for (const auto& [_, list] : View().mnListsCache) {
heights.push_back(list.GetHeight());
}
return heights;
}

//! The tip the current view was last told of.
const CBlockIndex* TipForTesting() EXCLUSIVE_LOCKS_REQUIRED(!cs)
{
LOCK(cs);
return View().tipIndex;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: The masternode manager exposes cache internals and a callback only tests use
Impact: Every build exposes private cache state and a hook that runs caller-supplied code under the manager lock on a list miss.

SetListSnapshotMissHookForTesting, CachedListHeightsForTesting, and TipForTesting add production API surface with no production callers, contrary to the project's convention against public test-only helpers. Keep the coverage, but assert the observable tip-list behavior where possible and move fault injection or cache-policy checks to a narrower test boundary.

source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)

@thepastaclaw thepastaclaw added the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 24, 2026
@thepastaclaw thepastaclaw removed the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 24, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

New on this head: The rebase leaves EvoDB view partitioning and production stall handling unchanged; it updates the stall tests for the warnings API and makes their assertions more specific. Lint, ClangFormat, Cppcheck, the macOS, ARM64 and fuzz builds, and the Linux no-wallet tests passed; other Linux and Windows jobs are pending, with no failed code checks reported.

🟡 9 suggestion(s) | 💬 1 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.

1 finding(s) not shown inline (the lines are not part of this PR's diff)

💬 Nitpick: The cache commit message describes an earlier scan guard that was never committed
Impact: A maintainer reading the cache commit's rationale can mistake an intermediate implementation for behavior in its parent commit.
<commit:be0060a43b8>:1

The paragraph beginning “RequireSatisfiedScan treated any short height-index scan” makes the enablement check read like a fix to an existing guard, but fc467a7a824 has neither helper; be0060a43b8 adds both together. The code does short-circuit after checking the upper end of the missing range, so the issue is the history described in the message, not a missing early return. State the invariant directly: a short scan is incomplete only if the missing range could contain a commitment of the requested type.

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 (9)

  • 🟡 Suggestion: Restart looks up the snapshot tip's EHF signals in the background database — src/evo/mnhftx.cpp:317-323 (thread)
  • 🟡 Suggestion: Missing snapshot quorum history can terminate the InstantSend worker and node — src/instantsend/net_instantsend.cpp:435-439 (thread)
  • 🟡 Suggestion: Rolling back a background block evicts its masternode list from the wrong view — src/validation.cpp:3695-3708 (thread)
  • 🟡 Suggestion: A missing snapshot coinbase is treated as having no ChainLock — src/evo/cbtx.cpp:210-221 (thread)
  • 🟡 Suggestion: A quorum lookup that spans snapshot activation can cache data under the wrong view — src/llmq/quorumsman.cpp:79-95 (thread)
  • 🟡 Suggestion: A retired snapshot scope can access the replacement generation — src/evo/evodb.h:349 (thread)
  • 🟡 Suggestion: A quorum's first legal mining block can stall on history that cannot contain its commitment — src/llmq/blockprocessor.cpp:753-760 (thread)
  • 🟡 Suggestion: Missing an optional cache entry can make a complete quorum lookup fail — src/llmq/blockprocessor.cpp:824-825 (thread)
  • 🟡 Suggestion: The masternode manager exposes cache internals and a callback only tests use — src/evo/deterministicmns.h:841-865 (thread)
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: critical by gpt-6.2-sol (effort low) — The intricate cross-view changes alter consensus validation in src/llmq/blockprocessor.cpp and src/evo/cbtx.cpp by making missing pre-base quorum or coinbase history stall validation rather than be treated as absent.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (lane 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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — dash-core-commit-history (completed, effort high); agent phase2-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:be0060a43b8>`:
- [NITPICK] <commit:be0060a43b8>:1: The cache commit message describes an earlier scan guard that was never committed
  Impact: A maintainer reading the cache commit's rationale can mistake an intermediate implementation for behavior in its parent commit.
  The paragraph beginning “RequireSatisfiedScan treated any short height-index scan” makes the enablement check read like a fix to an existing guard, but `fc467a7a824` has neither helper; `be0060a43b8` adds both together. The code does short-circuit after checking the upper end of the missing range, so the issue is the history described in the message, not a missing early return. State the invariant directly: a short scan is incomplete only if the missing range could contain a commitment of the requested type.

In `src/evo/mnhftx.cpp`:
- [SUGGESTION] src/evo/mnhftx.cpp:317-323: Restart looks up the snapshot tip's EHF signals in the background database
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258317)

In `src/instantsend/net_instantsend.cpp`:
- [SUGGESTION] src/instantsend/net_instantsend.cpp:435-439: Missing snapshot quorum history can terminate the InstantSend worker and node
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258294)

In `src/validation.cpp`:
- [SUGGESTION] src/validation.cpp:3695-3708: Rolling back a background block evicts its masternode list from the wrong view
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258300)

In `src/evo/cbtx.cpp`:
- [SUGGESTION] src/evo/cbtx.cpp:210-221: A missing snapshot coinbase is treated as having no ChainLock
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258279)

In `src/llmq/quorumsman.cpp`:
- [SUGGESTION] src/llmq/quorumsman.cpp:79-95: A quorum lookup that spans snapshot activation can cache data under the wrong view
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258303)

In `src/evo/evodb.h`:
- [SUGGESTION] src/evo/evodb.h:349: A retired snapshot scope can access the replacement generation
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258321)

In `src/llmq/blockprocessor.cpp`:
- [SUGGESTION] src/llmq/blockprocessor.cpp:753-760: A quorum's first legal mining block can stall on history that cannot contain its commitment
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258314)
- [SUGGESTION] src/llmq/blockprocessor.cpp:824-825: Missing an optional cache entry can make a complete quorum lookup fail
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258310)

In `src/evo/deterministicmns.h`:
- [SUGGESTION] src/evo/deterministicmns.h:841-865: The masternode manager exposes cache internals and a callback only tests use
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258327)

@thepastaclaw thepastaclaw added the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 24, 2026
@thepastaclaw thepastaclaw removed the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 24, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 2 only (queue backlog)

New on this head: This revision moves the uncarried quorum-quarter test into the cache-partition commit without changing the final source tree. Lint, Cppcheck, ClangFormat, all reported source builds, and the Linux no-wallet tests passed; the standard Linux, ASan, TSan, and multiprocess tests and multiprocess lint are pending, with no failed checks reported.

🟡 9 suggestion(s) | 💬 1 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.

1 finding(s) not shown inline (the lines are not part of this PR's diff)

💬 Nitpick: The cache commit message describes an earlier scan guard that was never committed
Impact: A reader of the commit history can mistake an intermediate implementation for behavior that existed in the parent commit.
<commit:a91133cfc82>:1

The paragraph beginning “RequireSatisfiedScan treated any short height-index scan” reads as a description of prior behavior, but the parent contains no RequireSatisfiedScan; this commit introduces it with the type-aware check already in place. Describe the invariant directly: a short scan is complete when the quorum type could not have produced commitments in the missing range.

source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)

Still open from earlier rounds (9)

  • 🟡 Suggestion: A missing snapshot coinbase is treated as having no ChainLock — src/evo/cbtx.cpp:210-221 (thread)
  • 🟡 Suggestion: Missing snapshot quorum history can terminate the InstantSend worker and node — src/instantsend/net_instantsend.cpp:436-439 (thread)
  • 🟡 Suggestion: Restart looks up the snapshot tip's EHF signals in the background database — src/evo/mnhftx.cpp:424-433 (thread)
  • 🟡 Suggestion: Rolling back a background block evicts its masternode list from the wrong view — src/validation.cpp:3695-3708 (thread)
  • 🟡 Suggestion: A quorum lookup that spans snapshot activation can cache data under the wrong view — src/llmq/quorumsman.cpp:79-95 (thread)
  • 🟡 Suggestion: A quorum's first legal mining block can stall on history that cannot contain its commitment — src/llmq/blockprocessor.cpp:753-760 (thread)
  • 🟡 Suggestion: Missing an optional cache entry can make a complete quorum lookup fail — src/llmq/blockprocessor.cpp:824-825 (thread)
  • 🟡 Suggestion: A retired snapshot scope can access the replacement generation — src/evo/evodb.h:347-352 (thread)
  • 🟡 Suggestion: The masternode manager exposes cache internals and a callback only tests use — src/evo/deterministicmns.h:841-865 (thread)
Review provenance

Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The intricate cross-chainstate change alters consensus validation in src/llmq/blockprocessor.cpp, where mined-commitment lookups and quorum scans can now stall snapshot block validation rather than treat unavailable history as absent.
  • Phase 1 reviewers: not run (skipped for throughput: 14 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — dash-core-commit-history (completed, effort high); agent phase2-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:a91133cfc82>`:
- [NITPICK] <commit:a91133cfc82>:1: The cache commit message describes an earlier scan guard that was never committed
  Impact: A reader of the commit history can mistake an intermediate implementation for behavior that existed in the parent commit.
  The paragraph beginning “RequireSatisfiedScan treated any short height-index scan” reads as a description of prior behavior, but the parent contains no `RequireSatisfiedScan`; this commit introduces it with the type-aware check already in place. Describe the invariant directly: a short scan is complete when the quorum type could not have produced commitments in the missing range.

In `src/evo/cbtx.cpp`:
- [SUGGESTION] src/evo/cbtx.cpp:210-221: A missing snapshot coinbase is treated as having no ChainLock
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258279)

In `src/instantsend/net_instantsend.cpp`:
- [SUGGESTION] src/instantsend/net_instantsend.cpp:436-439: Missing snapshot quorum history can terminate the InstantSend worker and node
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258294)

In `src/evo/mnhftx.cpp`:
- [SUGGESTION] src/evo/mnhftx.cpp:424-433: Restart looks up the snapshot tip's EHF signals in the background database
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258317)

In `src/validation.cpp`:
- [SUGGESTION] src/validation.cpp:3695-3708: Rolling back a background block evicts its masternode list from the wrong view
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258300)

In `src/llmq/quorumsman.cpp`:
- [SUGGESTION] src/llmq/quorumsman.cpp:79-95: A quorum lookup that spans snapshot activation can cache data under the wrong view
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258303)

In `src/llmq/blockprocessor.cpp`:
- [SUGGESTION] src/llmq/blockprocessor.cpp:753-760: A quorum's first legal mining block can stall on history that cannot contain its commitment
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258314)
- [SUGGESTION] src/llmq/blockprocessor.cpp:824-825: Missing an optional cache entry can make a complete quorum lookup fail
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258310)

In `src/evo/evodb.h`:
- [SUGGESTION] src/evo/evodb.h:347-352: A retired snapshot scope can access the replacement generation
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258321)

In `src/evo/deterministicmns.h`:
- [SUGGESTION] src/evo/deterministicmns.h:841-865: The masternode manager exposes cache internals and a callback only tests use
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258327)

thepastaclaw
thepastaclaw previously approved these changes Nov 25, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

New on this head: The rebase onto 078b8a6d leaves all six patches unchanged, including the Evo cache partitioning and missing-history checks. GitHub Actions shows all reported source builds, the standard and no-wallet Linux tests, Lint, ClangFormat, and Cppcheck passing; the ASan, TSan, and multiprocess tests and multiprocess lint are still pending.

🟡 9 suggestion(s) | 💬 1 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.

1 finding(s) not shown inline (the lines are not part of this PR's diff)

💬 Nitpick: The cache commit message describes an earlier scan guard that was never committed
Impact: A maintainer tracing snapshot stalls through the history is pointed to a guard and failure mode that are absent from the parent.
<commit:c22e8deab891c4d734fa47d41fc5e00a337b949b>:1

The paragraph beginning “RequireSatisfiedScan treated any short height-index scan” reads as a description of the parent, but aa1df45b73d contains no such helper. This commit introduces the guard and the type-enablement test together. Describe the resulting rule directly: a short scan need not consult missing history when the quorum type could not have been enabled there.

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 (9)

  • 🟡 Suggestion: A missing snapshot coinbase is treated as having no ChainLock — src/evo/cbtx.cpp:210-220 (thread)
  • 🟡 Suggestion: Missing snapshot quorum history can terminate the InstantSend worker and node — src/instantsend/net_instantsend.cpp:435-439 (thread)
  • 🟡 Suggestion: Rolling back a background block evicts its masternode list from the wrong view — src/validation.cpp:3675-3689 (thread)
  • 🟡 Suggestion: Restart looks up the snapshot tip's EHF signals in the background database — src/evo/mnhftx.cpp:424-433 (thread)
  • 🟡 Suggestion: A quorum lookup that spans snapshot activation can cache data under the wrong view — src/llmq/quorumsman.cpp:79-95 (thread)
  • 🟡 Suggestion: A quorum's first legal mining block can stall on history that cannot contain its commitment — src/llmq/blockprocessor.cpp:753-760 (thread)
  • 🟡 Suggestion: Missing an optional cache entry can make a complete quorum lookup fail — src/llmq/blockprocessor.cpp:824-825 (thread)
  • 🟡 Suggestion: A retired snapshot scope can access the replacement generation — src/evo/evodb.h:347-352 (thread)
  • 🟡 Suggestion: The masternode manager exposes cache internals and a callback only tests use — src/evo/deterministicmns.h:841-865 (thread)
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: critical by gpt-6.2-sol (effort low) — The diff intricately changes consensus validation across chainstates: src/validation.h makes EHF-gated deployment-state caching view-specific, and src/llmq/blockprocessor.cpp makes commitment checks report unavailable snapshot history rather than treating it as absence.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (lane 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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — dash-core-commit-history (completed, effort high); agent phase2-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:c22e8deab891c4d734fa47d41fc5e00a337b949b>`:
- [NITPICK] <commit:c22e8deab891c4d734fa47d41fc5e00a337b949b>:1: The cache commit message describes an earlier scan guard that was never committed
  Impact: A maintainer tracing snapshot stalls through the history is pointed to a guard and failure mode that are absent from the parent.
  The paragraph beginning “RequireSatisfiedScan treated any short height-index scan” reads as a description of the parent, but `aa1df45b73d` contains no such helper. This commit introduces the guard and the type-enablement test together. Describe the resulting rule directly: a short scan need not consult missing history when the quorum type could not have been enabled there.

In `src/evo/cbtx.cpp`:
- [SUGGESTION] src/evo/cbtx.cpp:210-220: A missing snapshot coinbase is treated as having no ChainLock
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258279)

In `src/instantsend/net_instantsend.cpp`:
- [SUGGESTION] src/instantsend/net_instantsend.cpp:435-439: Missing snapshot quorum history can terminate the InstantSend worker and node
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258294)

In `src/validation.cpp`:
- [SUGGESTION] src/validation.cpp:3675-3689: Rolling back a background block evicts its masternode list from the wrong view
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258300)

In `src/evo/mnhftx.cpp`:
- [SUGGESTION] src/evo/mnhftx.cpp:424-433: Restart looks up the snapshot tip's EHF signals in the background database
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258317)

In `src/llmq/quorumsman.cpp`:
- [SUGGESTION] src/llmq/quorumsman.cpp:79-95: A quorum lookup that spans snapshot activation can cache data under the wrong view
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258303)

In `src/llmq/blockprocessor.cpp`:
- [SUGGESTION] src/llmq/blockprocessor.cpp:753-760: A quorum's first legal mining block can stall on history that cannot contain its commitment
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258314)
- [SUGGESTION] src/llmq/blockprocessor.cpp:824-825: Missing an optional cache entry can make a complete quorum lookup fail
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258310)

In `src/evo/evodb.h`:
- [SUGGESTION] src/evo/evodb.h:347-352: A retired snapshot scope can access the replacement generation
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258321)

In `src/evo/deterministicmns.h`:
- [SUGGESTION] src/evo/deterministicmns.h:841-865: The masternode manager exposes cache internals and a callback only tests use
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258327)

@thepastaclaw thepastaclaw added the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 25, 2026
@github-actions

Copy link
Copy Markdown

This pull request has conflicts, please rebase.

@thepastaclaw thepastaclaw removed the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 27, 2026
thepastaclaw
thepastaclaw previously approved these changes Nov 27, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 2 only (queue backlog)

New on this head: This revision keeps Evo-derived caches partitioned by chainstate view and updates the stacked snapshot-stall and rejection handling and its regression tests. The container-use jobs are still queued, with no completed build or test result for this head, and develop’s serializer migration conflicts in src/evo/evodb.h. The 10-comment cap leaves five additional verified suggestions unposted.

🟡 9 suggestion(s) | 💬 1 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.

1 finding(s) not shown inline (the lines are not part of this PR's diff)

💬 Nitpick: The cache commit message describes an earlier scan guard that was never committed
Impact: A reader tracing the scan behavior is led to look for a guard that does not exist in the parent commit.
<commit:03e2d902b2ff5a17089cd3cd3ec3fe2b80ecec5b>:1

“RequireSatisfiedScan treated any short height-index scan” reads as a description of the prior code, but parent 2486bf41bce has no such helper. This commit lands the guard and its enablement qualification together. State the invariant directly: a short scan needs missing history only if that quorum type could have had a commitment in the missing range.

source: gpt-6.2-astra (phase2-reviewer: general)

Still open from earlier rounds (9)

  • 🟡 Suggestion: Missing snapshot quorum history can terminate the InstantSend worker and node — src/instantsend/net_instantsend.cpp:453-464 (thread)
  • 🟡 Suggestion: Rolling back a background block evicts its masternode list from the wrong view — src/validation.cpp:3668-3681 (thread)
  • 🟡 Suggestion: A missing snapshot coinbase is treated as having no ChainLock — src/evo/cbtx.cpp:210-220 (thread)
  • 🟡 Suggestion: Restart looks up the snapshot tip's EHF signals in the background database — src/evo/mnhftx.cpp:422-431 (thread)
  • 🟡 Suggestion: A quorum lookup that spans snapshot activation can cache data under the wrong view — src/llmq/quorumsman.cpp:79-95 (thread)
  • 🟡 Suggestion: A retired snapshot scope can access the replacement generation — src/evo/evodb.h:347-352 (thread)
  • 🟡 Suggestion: A quorum's first legal mining block can stall on history that cannot contain its commitment — src/llmq/blockprocessor.cpp:753-760 (thread)
  • 🟡 Suggestion: Missing an optional cache entry can make a complete quorum lookup fail — src/llmq/blockprocessor.cpp:824-825 (thread)
  • 🟡 Suggestion: The masternode manager exposes cache internals and a callback only tests use — src/evo/deterministicmns.h:841-865 (thread)
Review provenance

Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The new commit makes intricate changes to consensus validation: src/llmq/blockprocessor.cpp distinguishes missing snapshot history from absent commitments, and src/evo/specialtxman.cpp scopes cached coinbase ChainLock signature-verification results to the chainstate view.
  • Phase 1 reviewers: not run (skipped for throughput: 29 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — dash-core-commit-history (completed, effort high); agent phase2-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:03e2d902b2ff5a17089cd3cd3ec3fe2b80ecec5b>`:
- [NITPICK] <commit:03e2d902b2ff5a17089cd3cd3ec3fe2b80ecec5b>:1: The cache commit message describes an earlier scan guard that was never committed
  Impact: A reader tracing the scan behavior is led to look for a guard that does not exist in the parent commit.
  “RequireSatisfiedScan treated any short height-index scan” reads as a description of the prior code, but parent `2486bf41bce` has no such helper. This commit lands the guard and its enablement qualification together. State the invariant directly: a short scan needs missing history only if that quorum type could have had a commitment in the missing range.

In `src/instantsend/net_instantsend.cpp`:
- [SUGGESTION] src/instantsend/net_instantsend.cpp:453-464: Missing snapshot quorum history can terminate the InstantSend worker and node
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258294)

In `src/validation.cpp`:
- [SUGGESTION] src/validation.cpp:3668-3681: Rolling back a background block evicts its masternode list from the wrong view
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258300)

In `src/evo/cbtx.cpp`:
- [SUGGESTION] src/evo/cbtx.cpp:210-220: A missing snapshot coinbase is treated as having no ChainLock
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258279)

In `src/evo/mnhftx.cpp`:
- [SUGGESTION] src/evo/mnhftx.cpp:422-431: Restart looks up the snapshot tip's EHF signals in the background database
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258317)

In `src/llmq/quorumsman.cpp`:
- [SUGGESTION] src/llmq/quorumsman.cpp:79-95: A quorum lookup that spans snapshot activation can cache data under the wrong view
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258303)

In `src/evo/evodb.h`:
- [SUGGESTION] src/evo/evodb.h:347-352: A retired snapshot scope can access the replacement generation
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258321)

In `src/llmq/blockprocessor.cpp`:
- [SUGGESTION] src/llmq/blockprocessor.cpp:753-760: A quorum's first legal mining block can stall on history that cannot contain its commitment
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258314)
- [SUGGESTION] src/llmq/blockprocessor.cpp:824-825: Missing an optional cache entry can make a complete quorum lookup fail
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258310)

In `src/evo/deterministicmns.h`:
- [SUGGESTION] src/evo/deterministicmns.h:841-865: The masternode manager exposes cache internals and a callback only tests use
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258327)

Comment thread src/instantsend/net_instantsend.cpp Resolved
@thepastaclaw thepastaclaw added the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 29, 2026
Comment thread src/evo/creditpool.cpp
const EvoViewToken view{evoDb.CurrentView()};
CCreditPool pool;
if (WITH_LOCK(cache_mutex, return creditPoolCache.get(block_hash, pool))) {
if (WITH_LOCK(cache_mutex, return creditPoolCache.For(view).get(block_hash, pool))) {

@knst knst Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why For() is needed if block_hash are unique and should produce the exact same output?

keep cached the absolutely same, otherwise it's meaningless duplicates. Concept NACK

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're the same output only when the snapshot is honest, and background validation is there to check exactly that.

A credit pool isn't a function of the block alone. It's the previous block's pool plus this block's locks and unlocks. On the snapshot chainstate the chain of pools starts from credit_pool, which the snapshot carries at its base, and nothing has validated it yet. The background chainstate derives the pool at that same base block hash from genesis.

If the cache were keyed by hash alone:

  • When the background chainstate reaches the base, GetFromCache returns the pool the snapshot view cached there. NORMAL never derives its own, so it can't detect a wrong carried pool and simply inherits it.
  • After a rejection, the snapshot view's pools for blocks above the base stay in the cache. NORMAL is served them when it later connects those same hashes.

So on the snapshot side a block hash identifies the block, but not the state that was used to compute its pool. Caches that really are functions of the block bytes stay shared and keyed by hash only, for example block_data_cache a few lines up (GetCreditDataFromBlock). Only caches whose value depends on prior Evo state are partitioned. Once the generation is promoted, the epoch bump drops all partitions, and from then on there is again one view per hash.


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re the concept NACK: I agree the values match for every block that both chainstates validate. The problem is the blocks the snapshot chainstate never validated.

The snapshot chainstate's values at and below the base come from state the snapshot carries: the MN lists and historical diffs, quorums, credit pool and EHF signals, which are seeded in #7593. Its values above the base are derived from that carried state. None of it has been checked until the background chainstate reaches the base. The background chainstate also connects those same block hashes below the base. If it reads them from a shared cache, it builds on the snapshot's unchecked values instead of deriving its own. A wrong snapshot then goes undetected, which is the one thing background validation exists to catch. Per-view partitions keep the two apart.

Partitioning everything is the broadest way to get that, though, not the only one. A narrower shape that keeps one shared cache per object:

  1. Don't cache values the snapshot view reads or derives at or below its base.
  2. Drop every Evo cache when a generation is rejected.

Above the base, NORMAL never connects a block while the generation is live, so sharing is safe there. After promotion, everything is validated anyway. That removes EvoViewCache and most of the 62 For(view) call sites. The cost is that snapshot-side lookups below the base always read from disk.

Would that shape address your NACK? If so, I'll rework #8238 along those lines. If you think caching unvalidated snapshot state for the background chainstate is acceptable as it is, please say what catches a wrong carried value in that case.


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

@knst knst Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a rejection, the snapshot view's pools for blocks above the base stay in the cache. NORMAL is served them when it later connects those same hashes.

That are caches, no need to clean them intentinally, they will be cleared by LRU rules or with restart or any other default way to clean them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, that scenario doesn't hold. Both rejection paths, a mismatch and a failed completion check, shut the node down, so whatever the snapshot view cached above the base is gone at the restart. I'm withdrawing it.

I'm now going through each object that has its own For(), to keep partitioning only where the snapshot view can cache a value for a hash at or below the base that the background chainstate later looks up. I'll come back on this thread with the narrowed set, and a test for each one I keep.


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 275183e4099: creditPoolCache is a plain Uint256LruHashMap again, with no For(). This is the credit-pool variant from earlier in this thread.

The single rule that replaces the partition is in CCreditPoolManager::MaybeCache: a pool the snapshot view holds at or below its base, the carried one, is never inserted into the shared cache. The same goes for a pool read under a view that a default switch has overtaken. Above the base the snapshot chainstate caches as usual, because the background chainstate never connects those blocks while both run. In the other direction, a pool the background derived and cached is served to the snapshot side, which is correct. MaybeWriteSnapshot also no longer writes a derived pool record at or below a snapshot view's base, since that view holds only the carried record there. evo_db_tests/credit_pool_carried_at_the_snapshot_base_is_not_served_to_the_background still checks the case this guards: the background chainstate gets its own pool for the base after the snapshot side has read the carried one.

The other partitions stay, for the reasons in the description. Each value there is derived from carried state below the base, where the background chainstate's own block-by-block derivation reads the same hashes through the cache.


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One consequence of the shared credit-pool cache, so you can judge it. The guarantee is now "the background chainstate never gets the snapshot's pool at or below the base", and no longer "for any block". Above the base the snapshot chainstate caches as usual. That is what keeps its own lookups cheap, and the background chainstate never connects those blocks while both run. A rejection shuts the node down, and promotion validates them. Two tests in the layers above asked NORMAL about a block above the base anyway, which no real path does. They now start from an empty cache there (#8270 and #7593, test-only ClearCacheForTesting).


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

caches above snapshot should not be re-used by background block validation by mistake for security / safety reasons.
I miss that part before. I will give feedback on PR later when I will have fresh view.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. That is exactly what the remaining partitions guarantee: nothing the snapshot view derives is ever served to background block validation, above the base or below it.

The credit pool is the one exception at 275183e4099, per your earlier ask. It's a single cache that refuses the snapshot side's pools at or below the base, but not above it (see #8238 (comment)). If you'd rather have the stricter guarantee there too, I'll put its partition back so it matches the others. I'll wait for your full review before changing anything else.


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still NACK, I am working on alternate solution: #8284

When I am done with self-review, I will prepare replacement for some PRs in the series, include this PR:

AssumeUTXO stack (merge in this order; each PR holds the commits of the ones below it): #8238 → #7887 → #8270 → #7593 → #8271 → #7601 → #8272 → #8078 → #8273 → #8079 → #8276.

@knst knst left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why every object such as CreditPool has own For()?

Every block_hash is unique and should produce the exact same output for the same block, whatever it is snapshot or background chain or anything else.

Concept NACK, I can't justify it for now.

@thepastaclaw thepastaclaw removed the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 29, 2026
thepastaclaw
thepastaclaw previously approved these changes Nov 29, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

New on this head: This head narrows Evo-view partitioning to caches whose values can be derived from snapshot-carried state, restores shared handling for four caches, and adds regression coverage for the credit-pool case. CI has passed lint, cppcheck, formatting, repository, and cache checks; Linux, fuzz, macOS, Windows, and multiprocess build jobs remain queued or in progress with no reported code-check failure.

🟡 3 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

2 finding(s) not shown inline (the lines are not part of this PR's diff)

🟡 Suggestion: fixup! commits leave the cache-partition feature split across permanent history
Impact: The cache-partitioning change remains spread across fourteen fixup commits and one amend commit, making the final view-ownership and cache-lifetime invariants harder to audit and causing blame and bisect to land on review-correction patches.
<commit:5594cf3ae51>:1

The current PR range still contains fourteen literal fixup! commits plus the amend! commit 19d24610258, including the latest corrections 0621e1d32ae, d1f91a3c02a, 6e75fedcbe0, 19d24610258, and 5594cf3ae51. These patches refine the same cache-partition feature rather than representing independent historical changes. Autosquash the corrections into the logical feature commit before merging so the permanent history has auditable boundaries.

source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-sol (phase2-reviewer: general, dash-core-commit-history)

🟡 Suggestion: The amended feature message describes RequireSatisfiedScan as pre-existing code
Impact: Readers auditing the permanent history can misattribute the scan guard and misunderstand which behavior the cache-partition commit introduced.
<commit:19d24610258>:1

The amended message says that RequireSatisfiedScan treated every short height-index scan as requiring missing history, then describes the type-aware enablement check as a correction. The logical parent of the feature commit (1370095ea83) contains no RequireSatisfiedScan; the helper and this rule are introduced by the feature itself. Reword that paragraph to describe the invariant added by the commit rather than behavior supposedly present beforehand.

source: gpt-6.2-sol (phase2-reviewer: general, dash-core-commit-history)

Still open from earlier rounds (1)

  • 🟡 Suggestion: The masternode manager exposes cache internals and a callback only tests use — src/evo/deterministicmns.h:869-895 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — This is a large, intricate cross-cutting cache and chainstate-view change, but it does not itself modify consensus rules, funds movement, cryptography, peer-facing deserialization, or storage migrations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — dash-core-commit-history (completed, effort high); agent phase2-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:5594cf3ae51>`:
- [SUGGESTION] <commit:5594cf3ae51>:1: `fixup!` commits leave the cache-partition feature split across permanent history
  Impact: The cache-partitioning change remains spread across fourteen fixup commits and one amend commit, making the final view-ownership and cache-lifetime invariants harder to audit and causing blame and bisect to land on review-correction patches.
  The current PR range still contains fourteen literal `fixup!` commits plus the `amend!` commit `19d24610258`, including the latest corrections `0621e1d32ae`, `d1f91a3c02a`, `6e75fedcbe0`, `19d24610258`, and `5594cf3ae51`. These patches refine the same cache-partition feature rather than representing independent historical changes. Autosquash the corrections into the logical feature commit before merging so the permanent history has auditable boundaries.

In `<commit:19d24610258>`:
- [SUGGESTION] <commit:19d24610258>:1: The amended feature message describes `RequireSatisfiedScan` as pre-existing code
  Impact: Readers auditing the permanent history can misattribute the scan guard and misunderstand which behavior the cache-partition commit introduced.
  The amended message says that `RequireSatisfiedScan` treated every short height-index scan as requiring missing history, then describes the type-aware enablement check as a correction. The logical parent of the feature commit (`1370095ea83`) contains no `RequireSatisfiedScan`; the helper and this rule are introduced by the feature itself. Reword that paragraph to describe the invariant added by the commit rather than behavior supposedly present beforehand.

In `src/evo/deterministicmns.h`:
- [SUGGESTION] src/evo/deterministicmns.h:869-895: The masternode manager exposes cache internals and a callback only tests use
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258327)

@thepastaclaw thepastaclaw added the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 29, 2026
@github-actions

Copy link
Copy Markdown

This pull request has conflicts, please rebase.

@thepastaclaw thepastaclaw removed the pastaclaw:approved thepastaclaw's latest review approved this PR label Nov 29, 2026
thepastaclaw
thepastaclaw previously approved these changes Nov 29, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

New on this head: The head keeps the view-partitioned Evo cache design and adds the per-view previous-coinbase ChainLock slot plus its regression coverage; no other functional changes were introduced since the prior review. The main check succeeded, while container-use jobs remain queued, build-container jobs were skipped, and the review check is still in progress; the branch also has the known develop conflict in src/llmq/blockprocessor.cpp.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Still open from earlier rounds (1)

  • 🟡 Suggestion: The masternode manager exposes cache internals and a callback only tests use — src/evo/deterministicmns.h:869-895 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — This is a large, intricate cross-cutting cache and chainstate behavior change, but it does not itself modify consensus rules, funds movement, cryptography, peer-facing deserialization, or storage migrations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — dash-core-commit-history (completed, effort high); agent phase2-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/deterministicmns.h`:
- [SUGGESTION] src/evo/deterministicmns.h:869-895: The masternode manager exposes cache internals and a callback only tests use
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258327)

thepastaclaw
thepastaclaw previously approved these changes Nov 29, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

New on this head: The current head is a single cache-partitioning commit; relative to the previously reviewed head, the only code change is the CQuorumBlockProcessor constructor migration to the RAII CCheckQueue initialization. No code checks have failed; build, lint, cppcheck, and platform checks are still queued or in progress.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Still open from earlier rounds (1)

  • 🟡 Suggestion: The masternode manager exposes cache internals and a callback only tests use — src/evo/deterministicmns.h:875-891 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — This is a large, intricate cross-cutting cache and chainstate-validation change, but the diff does not itself alter consensus rules, funds movement, cryptography, peer-facing deserialization, or storage migrations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — dash-core-commit-history (completed, effort high); agent phase2-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/deterministicmns.h`:
- [SUGGESTION] src/evo/deterministicmns.h:875-891: The masternode manager exposes cache internals and a callback only tests use
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258327)

Comment thread src/evo/cbtx.cpp Outdated
if (!blockman.ReadBlockFromDisk(block, *pindex)) {
// A snapshot view lacks the bodies at or below its base, where a
// coinbase ChainLock that cannot be read cannot be told from none.
if (view.identity == EvoDbIdentity::SNAPSHOT && pindex->nHeight <= view.base_height &&

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's passed both EvoViewToken & BlockManager.
I think it would be more convenient if EvoViewToken will call BlockManager inside and will return error if data unavailable or a block as expected.

So, multiple view.identity == EvoDbIdentity::SNAPSHOT && pindex->nHeight <= view.base_height + check pindex->nStatus & BLOCK_HAVE_DATA is extremely unreliable, also it's copied multiple time.

Consider adding a helper to view to do all checks at once.

Also,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if EvoViewToken & BlockManager is not giving any benefits, consider using AtOrBelowSnapshotBase at least consistently all over codebase.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 77ec00c2aed, still one commit.

A few other body reads in the upper layers check BLOCK_HAVE_DATA themselves: the credit-pool window, work-block modifiers in llmq/utils.cpp, and CSpecialTxProcessor::GetCoinbaseChainlock. Each behaves differently for a pruned NORMAL node, for example a status instead of an exception, so I haven't folded them in. If you want them on the same helper, I'll do it per layer.


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

Comment thread src/versionbits.cpp
ThresholdState state = VersionBitsConditionChecker(pos).GetStateFor(pindexPrev, params, m_caches[pos]);
if (state == ThresholdState::LOCKED_IN || state == ThresholdState::STARTED) {
nVersion |= Mask(params, pos);
return Tentatively(keep, [&]() EXCLUSIVE_LOCKS_REQUIRED(m_mutex) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why version-bits-cache requires knowledge about snapshots?

How bitcoin does resolve it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For BIP9 deployments it doesn't, and those are shared exactly as upstream does it. Bitcoin's versionbits state is a function of block headers (nVersion) alone. A snapshot node has every header, so both chainstates compute the same state from PoW-validated data, and one cache is correct.

Dash's EHF deployments (useEHF, e.g. V24 and EVO_SHARES) are different: SignalHeight reads MNHF signals, and those live in block bodies (quorum-signed MNHF transactions), not in headers. Below its base the snapshot node has no bodies, so its signals come from mnhf_signals in the snapshot. That is the data the snapshot carries, unvalidated until background completion. In the honest case the two chainstates agree and the cached states are identical. With a wrong carried signal, the snapshot side's state for an EHF deployment at a period boundary below the base differs from the background's. A shared cache would then make the background chainstate apply V24 rules to its own pre-base blocks on the snapshot's word, and the completion check could no longer catch it.

That's the only reason this cache knows about snapshots. If you'd rather keep one cache here too, it can take the same shape as the credit pool: a single VersionBitsCache, where a computation under the snapshot view keeps no EHF-deployment state for a period at or below its base. The KeepStates hook in this PR is already the place to refuse that. That would replace EvoViewVersionBitsCache's per-view partitions. Do you want that?


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/validation.h
bool DeploymentActiveAt(const CBlockIndex& index, const ChainstateManager& chainman, DEP dep)
{
return DeploymentActiveAt(index, chainman.GetConsensus(), dep, chainman.m_versionbitscache);
if constexpr (std::is_same_v<DEP, Consensus::BuriedDeployment>) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why background cache and snapshot cache could be different?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For BIP9 deployments it doesn't, and those are shared exactly as upstream does it. Bitcoin's versionbits state is a function of block headers (nVersion) alone. A snapshot node has every header, so both chainstates compute the same state from PoW-validated data, and one cache is correct.

Dash's EHF deployments (useEHF, e.g. V24 and EVO_SHARES) are different: SignalHeight reads MNHF signals, and those live in block bodies (quorum-signed MNHF transactions), not in headers. Below its base the snapshot node has no bodies, so its signals come from mnhf_signals in the snapshot. That is the data the snapshot carries, unvalidated until background completion. In the honest case the two chainstates agree and the cached states are identical. With a wrong carried signal, the snapshot side's state for an EHF deployment at a period boundary below the base differs from the background's. A shared cache would then make the background chainstate apply V24 rules to its own pre-base blocks on the snapshot's word, and the completion check could no longer catch it.

That's the only reason this cache knows about snapshots. If you'd rather keep one cache here too, it can take the same shape as the credit pool: a single VersionBitsCache, where a computation under the snapshot view keeps no EHF-deployment state for a period at or below its base. The KeepStates hook in this PR is already the place to refuse that. That would replace EvoViewVersionBitsCache's per-view partitions. Do you want that?


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/validation.h
* states are Evo state, so a state computed under one view is never served to
* another. The calling thread's view also selects the EHF signals that
* SignalHeight reads, so the partition and its inputs always agree. */
class EvoViewVersionBitsCache

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snapshot should have information about EHF signals.
snapshot should have information about how many blocks had been signalling.

Why bitcoin doesn't have this code but dash core has it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For BIP9 deployments it doesn't, and those are shared exactly as upstream does it. Bitcoin's versionbits state is a function of block headers (nVersion) alone. A snapshot node has every header, so both chainstates compute the same state from PoW-validated data, and one cache is correct.

Dash's EHF deployments (useEHF, e.g. V24 and EVO_SHARES) are different: SignalHeight reads MNHF signals, and those live in block bodies (quorum-signed MNHF transactions), not in headers. Below its base the snapshot node has no bodies, so its signals come from mnhf_signals in the snapshot. That is the data the snapshot carries, unvalidated until background completion. In the honest case the two chainstates agree and the cached states are identical. With a wrong carried signal, the snapshot side's state for an EHF deployment at a period boundary below the base differs from the background's. A shared cache would then make the background chainstate apply V24 rules to its own pre-base blocks on the snapshot's word, and the completion check could no longer catch it.

That's the only reason this cache knows about snapshots. If you'd rather keep one cache here too, it can take the same shape as the credit pool: a single VersionBitsCache, where a computation under the snapshot view keeps no EHF-deployment state for a period at or below its base. The KeepStates hook in this PR is already the place to refuse that. That would replace EvoViewVersionBitsCache's per-view partitions. Do you want that?


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

@knst knst Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SignalHeight reads MNHF signals, and those live in block bodies (quorum-signed MNHF transactions), not in header

that signal should be part of snapshot; that's a critical data to make EHF working. without that assumeutxo is uncompatible with forks such as v24.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, and it is part of the snapshot. #7593 carries the MNHF signal record at the base (mnhf_signals, the raw record plus the stage derived below it). It's covered by the pinned evo_hash, so the snapshot chainstate follows V24 and other EHF forks from it. Nothing here changes that.

The partition is only about the other direction. Like the UTXO set, the carried signals are trusted through the pin, and the background chainstate exists to check that pin. Upstream likewise never lets the background chainstate read the snapshot chainstate's coins cache. If the background takes EHF deployment states that the snapshot side computed from the carried record, it applies V24 to its own pre-base blocks on the snapshot's word, and completion compares the carried record with itself.

The single-cache shape from my previous reply keeps exactly that and nothing more: one VersionBitsCache, and the snapshot view doesn't keep an EHF-deployment state for a period at or below its base. Shall I make that change?


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

thepastaclaw
thepastaclaw previously approved these changes Nov 29, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

New on this head: This revision keeps the credit pool in a shared block-hash cache, excludes pools read or derived by the snapshot view at or below its base, and centralizes snapshot-base and block-body checks. The PR is mergeable against current develop; the overlapping assumevalid signature optimization does not supersede the cache changes. ClangFormat passed, no checks are failing, and the container reuse jobs are pending.

🟡 1 suggestion(s) | 💬 1 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.

1 finding(s) not shown inline (the lines are not part of this PR's diff)

💬 Nitpick: The commit message calls all hash-keyed caches partitioned even though the credit-pool cache stays shared
Impact: Maintainers reading the commit get two conflicting descriptions of how the credit-pool cache separates snapshot state from background validation.
<commit:275183e4099>:1

The commit message gives the wrong rule for the credit pool before describing its exception. It says “Every cache keyed by a block or quorum hash” uses a view partition, but creditPoolCache is keyed only by block hash and MaybeCache excludes pools read or derived in the snapshot view at or below its base. Introduce the partitioned caches as a list rather than a universal rule.

source: gpt-6.2-sol (phase2-reviewer: general, dash-core-commit-history)

Still open from earlier rounds (1)

  • 🟡 Suggestion: The masternode manager exposes cache internals and a callback only tests use — src/evo/deterministicmns.h:869-899 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — This is a large and intricate cross-cutting cache and chainstate-view change, but the diff does not itself modify consensus rules, funds movement, cryptography, peer-facing deserialization, or storage migrations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — dash-core-commit-history (completed, effort high); agent phase2-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:275183e4099>`:
- [NITPICK] <commit:275183e4099>:1: The commit message calls all hash-keyed caches partitioned even though the credit-pool cache stays shared
  Impact: Maintainers reading the commit get two conflicting descriptions of how the credit-pool cache separates snapshot state from background validation.
  The commit message gives the wrong rule for the credit pool before describing its exception. It says “Every cache keyed by a block or quorum hash” uses a view partition, but `creditPoolCache` is keyed only by block hash and `MaybeCache` excludes pools read or derived in the snapshot view at or below its base. Introduce the partitioned caches as a list rather than a universal rule.

In `src/evo/deterministicmns.h`:
- [SUGGESTION] src/evo/deterministicmns.h:869-899: The masternode manager exposes cache internals and a callback only tests use
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258327)

@github-actions

Copy link
Copy Markdown

This pull request has conflicts, please rebase.

@thepastaclaw thepastaclaw left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 2 only (queue backlog)

Updated after discussion: 1 finding(s) of this review were settled in the inline threads.

  • ✅ Withdrawn: 🟡 GetQcHashes can reuse an active-quorum set after the mined commitment it depends on changes

New on this head: This head is a single squashed commit that partitions Evo-derived caches by chainstate view and adds the associated view-aware tests. ClangFormat and the main checks pass; the ASAN build and review checks are still queued, with no failed code checks reported.

🟡 2 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Still open from earlier rounds (1)

  • 🟡 Suggestion: The masternode manager exposes cache internals and a callback only tests use — src/evo/deterministicmns.h:875-892 (thread)
Review provenance

Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The large, intricate diff changes consensus-critical block validation and chainstate behavior in files such as src/validation.cpp and src/llmq/blockprocessor.cpp, including handling of unavailable historical Evo/LLMQ state.
  • Phase 1 reviewers: not run (skipped for throughput: 11 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — dash-core-commit-history (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `src/llmq/blockprocessor.cpp`:
- [SUGGESTION → WITHDRAWN in discussion; do not fix] src/llmq/blockprocessor.cpp:479-484: `GetQcHashes` can reuse an active-quorum set after the mined commitment it depends on changes
  Impact: When a mined commitment is added or erased after an active set was cached for the same block, later quorum-hash lookups can use stale quorum bases and reject otherwise valid validation results.
  A commitment update invalidates the mined-commitment-derived quorum set, but `DropQcHashesCache` clears only the ordinary quorum and QC-hash fields. The per-view `m_active_quorums_block` remains equal to the queried block, so `GetActiveCommitmentsCached` returns the old `m_active_quorums` without rereading the changed commitment index. Clear the active-quorum block marker and set whenever this invalidation runs.

In `src/evo/deterministicmns.h`:
- [SUGGESTION] src/evo/deterministicmns.h:875-892: The masternode manager exposes cache internals and a callback only tests use
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258327)

Comment thread src/llmq/blockprocessor.cpp Resolved
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

Rebased onto develop with #8263, and squashed into one commit again: ae9d1c48e4a (fix(evo): partition Evo-derived caches by view) on develop 8413d7694cd.

Credit pool: the per-view partition is back. I went with the partition over making the snapshot read its own carried pool first. You asked that caches from above the snapshot not be reused by background validation by mistake. A partition rules that out by construction, in both directions. With the shared cache, a pool the background chainstate had cached for the base could also stand in for the snapshot's carried one. The seed-first rule would have fixed only that half, and only on the lookup paths it guards. The shared-cache special cases (MaybeCache, the at-or-below-base skips) and the cache resets in the test scaffolding are gone. credit_pool_carried_at_the_snapshot_base_is_not_served_to_the_background now checks both directions: the background caches its pool first, the snapshot still reads the carried one, and the background then still gets its own. With the shared cache it fails: the snapshot read gets the background pool (100000000 != 500000000).

#8263's active quorum set is kept per view too. It moves into the existing QcHashesCache partition, so there is no new For(). Your comment on it already notes that the set depends on the view it is read through. The record of what each recent block mined stays shared, since it comes from the block itself. DropQcHashesCache(type, hash) keeps your narrower invalidation (drop the whole result, erase that base's LRU entry) in every partition. UndoBlock resets the cached set in every partition.

The versionbits question is unchanged: it still uses its own partition. I can switch it to the single VersionBitsCache with the KeepStates refusal if you prefer.

Could you re-review?


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

Isolating the snapshot generation's records is not enough while the
managers keep one cache for both chainstates. The snapshot chainstate
derives values at and below its base from state the snapshot carries,
which nothing has validated yet. The background chainstate connects the
same block hashes and, through a shared cache, took those values
instead of deriving its own: a list, quorum member set, mined-commitment
location or deployment state. For the credit pool at the base, the
background capture then recorded the carried pool, so completion
compared the carried pool with itself.

EvoViewCache keeps one partition per Evo view (EvoDB, identity,
generation). Every cache keyed by a block or quorum hash now resolves
the calling operation's view and uses only that partition: the MN-list
lists, diffs, tip and initial-snapshot anchor; quorum snapshots; MNHF
signals; credit pools; mined-commitment locations and the qc-hash caches,
including the active quorum set GetQcHashes derives from the previous
block's;
the quorum member caches; the quorum manager's quorum, scan and
commitment-scan caches; the versionbits cache; and the previous-coinbase
ChainLock slot, which a snapshot block's validation must read from the
same view the miner of its template did. The versionbits partition and
the EHF signals SignalHeight reads both come from the calling thread's
view. Caches of data parsed from block bytes and the vvec/skshare stores
stay shared, and so do the warning cache, the quorum proof caches and the
quorum-data cleanup cache: only the active view fills them, a rejected
snapshot shuts the node down, and a promoted one has been validated.
What a block mined is read from the block itself, so the record of the
commitments recent blocks mined stays shared.
Retiring a generation drops its partitions at the next lookup and
leaves NORMAL's, so a failed snapshot load no longer empties the active
masternode list until the next block. Promoting a generation, like
opening a CEvoDB, bumps an epoch that drops every partition.
DeploymentActiveAfter/At through a ChainstateManager decide a buried
deployment by height alone, without resolving a view.

The MN-list cache of a view is pruned against the higher of its tip and
the highest block it processed: a view stops receiving tip notifications
once its chainstate is no longer the active one, so a stale tip would
keep its cache from ever being pruned.

EvoViewToken::AtOrBelowSnapshotBase() names the heights at which a snapshot
view holds only carried state, and ReadBlockInView() reads a block body
for a view, raising BlockDataUnavailableError where the snapshot view lacks
it instead of reporting the body as unreadable.

A snapshot view has no quorum history at or below its base once DIP3 is
active there (a base at or above the DIP3 height), so lookups that would
need it raise BlockDataUnavailableError instead of answering from
partial data: a mined-commitment scan that comes up short
(GetMinedCommitmentsUntilBlock, and the rotating per-index scan on a
miss), a HasMinedCommitment miss for a quorum at or below the base, and
the coinbase ChainLock read of a block at or below the base whose body
is not stored.

EHF signal lookups only read, as on develop since dashpay#8098, so
the signals are still written only when a block is connected or rebuilt
at startup, inside an Evo transaction. The MNHF signal cache keeps one
partition per view like the others. A snapshot view holds only what its
snapshot carried and its chainstate connected, and what else it lacks is
recovered by the startup that promotes the validated snapshot, so a
lookup there that finds no record raises BlockDataUnavailableError (a
stall) instead of EvoDbMissingStateError, which NORMAL keeps. The
startup rebuild never walks a snapshot view at or below its base, whose
blocks are unvalidated and whose bodies it lacks.

Adds CDeterministicMNManager::SetListSnapshotMissHookForTesting, which
reports lookups that miss both the cache and the stored lists, and
CachedListHeightsForTesting, for the partition and pruning tests and the
tests that need one lookup to fail. With the hook, a test also
rejects a snapshot in the middle of a block connection and checks that
the background chainstate becomes the active one.

A quorum scan is cached only when its start block is on the chain that
its view's mined-commitment index describes (dashpay#8102), now the
chain of the usable chainstate with the view's Evo identity
(ChainstateManager::EvoChain) instead of the active chain. A background
view's index follows the background chainstate, so its scans from blocks
it has not connected are not cached, and a view no usable chainstate
reads caches nothing.
chainstatemanager_rejection_mid_connect_activates_background checks that
mapping during dual operation and after a rejection.

RequireSatisfiedScan raises for a short height-index scan under a snapshot
view based at or above DIP3 only when the type was enabled at the end of
the missing range or at DIP3 activation: a type not enabled up to the base
has no commitments there, so its short scan is complete, and a CbTx
quorum-root check over it must not stall the snapshot chainstate. Deployment-gated types stay enabled once enabled, and the types
DIP0024 retires are enabled from DIP3 on. The check runs before the EvoDB
lock is taken, because deployment state can read EvoDB.

The mined-commitment walkers that getPlatformQuorum reads its window
with throw BlockDataUnavailableError under such a view when the window
reaches history the view lacks, even for a quorum in the part of the
window above the base.

The base is checked first, and the DIP3 ancestor is only looked up when
that check fails: a chain that does not reach genesis, such as the
testnet-height chain quorum_proofs_tests builds, has no such ancestor.

With the MN-list miss hook this adds, a test also rejects the snapshot in
an ActivateBestChain step that first disconnected one of its blocks, which
must not leave that block's transactions queued.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

New on this head: The current head is patch-equivalent to the previously reviewed single cache-partitioning commit, with only base-branch drift from the credit-pool block-data-cache change. Completed lint, format, cppcheck, cache, macOS, ARM64, and fuzz checks are successful; several source-build jobs remain in progress and no failed code checks are reported.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Still open from earlier rounds (1)

  • 🟡 Suggestion: The masternode manager exposes cache internals and a callback only tests use — src/evo/deterministicmns.h:875-885 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — This is a large, intricate cross-cutting cache and chainstate-view change affecting validation behavior, but the diff does not itself change consensus rules, funds movement, cryptography, peer-facing deserialization, or storage migrations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — dash-core-commit-history (completed, effort high); agent phase2-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/deterministicmns.h`:
- [SUGGESTION] src/evo/deterministicmns.h:875-885: The masternode manager exposes cache internals and a callback only tests use
  (carried; thread: https://github.com/dashpay/dash/pull/8238#discussion_r4676258327)

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

This pull request has conflicts, please rebase.

@knst

knst commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

superseeded by #8286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants