Repository navigation
feat: pin AssumeUTXO snapshots for mainnet and testnet - #8276
PastaPastaPasta wants to merge 80 commits into
Conversation
|
This pull request has conflicts, please rebase. |
1 similar comment
|
This pull request has conflicts, please rebase. |
|
🔍 Review in progress (commit 04496b5) · live progress
|
5e1d32c to
93e8702
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 2 only (queue backlog)
This change pins reviewed AssumeUTXO snapshots for mainnet and testnet, exposes the snapshot RPCs on those networks, and documents the supported files and loading procedure. The completed main and ClangFormat checks passed; the review check remains in progress, with no completed code check failures.
🟡 1 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
1 finding(s) not shown inline (GitHub refused the PR diff as too large)
🟡 Suggestion: The release-note correction is split from the commit that introduced the release note
Impact: Anyone tracing the AssumeUTXO documentation history sees a standalone corrective commit instead of one commit that introduces the correctly named release note.
<commit:93e8702>:1
The final commit only renames the release-note file and replaces (#pins) with (#8276), while the preceding commit creates the file with that temporary name and marker. This leaves an unnecessary historical seam without an independent behavioral change; fold this correction into 23c82575810 so the release note is introduced correctly in one logical commit.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — This very large, intricate diff changes consensus validation and chainstate/UTXO snapshot loading and promotion paths in validation.cpp, node/chainstate.cpp, and related storage code, directly affecting trusted state initialization and persistent blockchain state. - Phase 1 reviewers: not run (skipped for throughput: 14 PRs queued, above the 10 limit)
- Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— dash-core-commit-history (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `<commit:93e8702>`:
- [SUGGESTION] <commit:93e8702>:1: The release-note correction is split from the commit that introduced the release note
Impact: Anyone tracing the AssumeUTXO documentation history sees a standalone corrective commit instead of one commit that introduces the correctly named release note.
The final commit only renames the release-note file and replaces `(#pins)` with `(#8276)`, while the preceding commit creates the file with that temporary name and marker. This leaves an unnecessary historical seam without an independent behavioral change; fold this correction into `23c82575810` so the release note is introduced correctly in one logical commit.
thepastaclaw
left a comment
There was a problem hiding this comment.
CI failed after approval — commit 93e8702
The standing review approved this commit; this follow-up moves the verdict to COMMENT: checks that failed after the review look related to this change.
Failing checks:
Lint / Run linters(failure)linux64_asan-build / Build source(failure)
Why they look related: The lint failure is in test/functional/feature_assumeutxo.py, a file changed by this PR. The ASAN failure is an undefined-behavior sanitizer error in validation_chainstatemanager_tests.cpp, also changed by this PR, and occurs in an AssumeUTXO snapshot test.
Nothing was re-reviewed: the findings of the standing review are unchanged. The next push gets a full review; a re-run that passes does not restore the approval.
Review provenance
Source: CI-check lane gpt-6.2-sol (agent: triage); no reviewer or verifier lanes ran for this follow-up
- Verdict moved because CI failed on this commit after the review; failure logs read: 2 GitHub Actions job(s)
93e8702 to
0d6782e
Compare
0d6782e to
f74a6e5
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: This head rebases the AssumeUTXO snapshot pinning and RPC exposure changes onto the updated develop base; the pull request's own substantive commits remain unchanged. No code checks are failing: ClangFormat and title validation passed, while build jobs are skipped or still queued.
🟡 1 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
1 finding(s) not shown inline (GitHub refused the PR diff as too large)
🟡 Suggestion: The release-note correction is split from the commit that introduced the release note
Impact: The permanent history retains an avoidable documentation fixup: the release note is introduced under a temporary filename and placeholder reference, then corrected in a separate commit.
<commit:f74a6e5>:1
The final tree is correct, but commit 328ddd5f62b introduces the note as doc/release-notes-pins.md with (#pins), while f74a6e5181a separately renames it to doc/release-notes-8276.md and changes the reference to (#8276). Fold the rename and reference correction into the introducing documentation commit so the feature history contains one coherent release-note change.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: dash-core-commit-history)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — This is a large, intricate change that modifies consensus validation and chainstate/storage snapshot activation paths in files such as src/validation.cpp, src/node/chainstate.cpp, src/evo/snapshot.cpp, and src/rpc/blockchain.cpp. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `<commit:f74a6e5>`:
- [SUGGESTION] <commit:f74a6e5>:1: The release-note correction is split from the commit that introduced the release note
Impact: The permanent history retains an avoidable documentation fixup: the release note is introduced under a temporary filename and placeholder reference, then corrected in a separate commit.
The final tree is correct, but commit `328ddd5f62b` introduces the note as `doc/release-notes-pins.md` with `(#pins)`, while `f74a6e5181a` separately renames it to `doc/release-notes-8276.md` and changes the reference to `(#8276)`. Fold the rename and reference correction into the introducing documentation commit so the feature history contains one coherent release-note change.
1ec6684 test: Add test for loadtxoutset when headers are not synced 2bc1ecf test: Remove unnecessary sync_blocks in assumeutxo tests Pull request description: Test that loadtxoutset fails right away when the node lacks the snapshot base's header, which bitcoin#29345 changed from a ten-minute wait. Also drop a sync_blocks call that compared the disconnected nodes' identical cached chains. Dash adaptations: - The loading nodes here receive the new headers while n0 mines the snapshot chain, so the check runs on n3 after its datadir is wiped for the startup block import scenario, before it gets the headers, instead of on nodes 1 and 2 before the headers are ferried over. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a snapshot twice b259b0e [Test] Assumeutxo: ensure failure when importing a snapshot twice (Alfonso Roman Zubeldia) Pull request description: I am getting familiar with the `assume_utxo` tests and I found that the scenario of trying to activate a snapshot twice is not covered. This test is to ensure failure when loading a snapshot if there is already a snapshot-based chainstate. ACKs for top commit: fjahr: Code review ACK b259b0e kevkevinpal: tACK [b259b0e](bitcoin@b259b0e) achow101: ACK b259b0e rkrux: tACK [b259b0e](bitcoin@b259b0e) Tree-SHA512: 3510861390d0e40cdad6861b728df04827a1b63e642f3d956aee66ed2770b1cb7e3aa3eb00c62eb9da0544703c943cc5296936c9ebfcac18c719741c354421bb
… of dumptxoutset output 542e13b rpc: Enhance metadata of the dumptxoutset output (Fabian Jahr) 4d8e5ed assumeutxo: Add documentation on dumptxoutset serialization format (Fabian Jahr) c14ed7f assumeutxo: Add test for changed coin size value (Fabian Jahr) de95953 rpc: Optimize serialization disk space of dumptxoutset (Fabian Jahr) Pull request description: The second attempt at implementing the `dumptxoutset` space optimization as suggested in bitcoin#25675. Closes bitcoin#25675. This builds on the work done in bitcoin#26045, addresses open feedback, adds some further improvements (most importantly usage of compact size), documentation, and an additional test. The [original snapshot at height 830,000](bitcoin#29551) came in at 10.82 GB. With this change, the same snapshot is 8.94 GB, a reduction of 17.4%. This also enhances the metadata of the output file and adds the following data to allow for better error handling and make future upgrades easier: - A newly introduced utxo set magic - A version number - The network magic - The block height ACKs for top commit: achow101: ACK 542e13b TheCharlatan: Re-ACK 542e13b theStack: ACK 542e13b Tree-SHA512: 0825d30e5c3c364062db3c6cbca4e3c680e6e6d3e259fa70c0c2b2a7020f24a47406a623582040988d5c7745b08649c31110df4c10656aa25f3f27eb35843d99
…in#29612 efc1b5b test: Add coverage for txid coins count check when loading snapshot (Fabian Jahr) 6b60848 assumeutxo: Add network magic ctor param to SnapshotMetadata (Fabian Jahr) 1f1f998 assumeutxo: Deserialize trailing byte instead of Txid (Fabian Jahr) 359967e doc: Add release notes for bitcoin#29612 (Fabian Jahr) Pull request description: This adds release notes for bitcoin#29612 and addresses post-merge review comments. ACKs for top commit: maflcko: utACK efc1b5b theStack: utACK efc1b5b Tree-SHA512: 3b270202e4f7b2576090ef1d970fd54a6840d96fc3621dddd28e888fb8696a97ff69af2e000bcee3b364316ca3f6e2a9b2f1694c6184f0e704dc487823127ce4
…d not be loaded df6dc2a test: Assumeutxo: snapshots with less work should not be loaded (Hernan Marino) Pull request description: This PR adds a test which checks that snapshots with less accumulated work than the node's active chain, should not be loaded and return with an error. Although in a different context of discussion the missing test was detect in a thread in bitcoin#29394 (see bitcoin#29394 (comment)) ACKs for top commit: maflcko: utACK df6dc2a kevkevinpal: utACK [df6dc2a](bitcoin@df6dc2a) achow101: ACK df6dc2a alfonsoromanz: Re ACK df6dc2a. Make is successful and the test passes. Tree-SHA512: 07a394b4b288cc8ad3f66ed4e70dcda468db18113e9442eb7215cf491768432d55efaaa5b79d633094917e05475a30f0c5e4f64f8f2da293ba306891b4485560
…invalid chain 2f9bde6 test: Remove unnecessary restart in assumeutxo test 19ce3d4 assumeutxo: Check snapshot base block is not marked invalid 80315c0 refactor: Move early loadtxoutset checks into ActiveSnapshot Pull request description: ActivateSnapshot() returns a util::Result, so loadtxoutset reports why a load failed, and the checks that loadtxoutset made before calling it move into it. A base block in an invalid chain is refused. Dash adaptations: - 19ce3d4 is equivalent here: SnapshotActivationRefusal() already refuses a base whose chain has a block marked failed or ChainLock- conflicting, at load and again at the switch, so no second check is added. test_snapshot_block_invalidated runs on n0, the node with the downloaded chain, restarted with the pin for this check only (it never loads a snapshot), and matches the refusal's message. - The unrecognized-hash error names the hash and the metadata height and lists the available snapshot heights, as upstream at this point (bitcoin#29612 comes earlier in this stack; bitcoin#30598 later drops the height). - The refusals that this tree logs keep their log lines, which its tests and operators read; each now also returns its reason. Dash's own failures (another activation running, an earlier rejected snapshot, the Evo publication) return theirs too. - loadtxoutset looks the base up after activation for its tip_hash and base_height. - test_invalid_mempool_state (from bitcoin#29394, earlier in this stack) takes its bitcoin#30267 form, with n2 started with -persistmempool=0 as there. It overlaps a unit case of the refusals commit; both are kept. - 2f9bde6 is taken: test_snapshot_with_less_work (bitcoin#29428, earlier in this stack) no longer restarts node 0 after the refusal. Node 0 keeps the pin that check installed until test_invalid_chainstate_scenarios() restarts it without one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fa5b892 rpc: Use untranslated error strings in loadtxoutset (MarcoFalke) fa45865 refactor: Use named arguments to get path arg in loadtxoutset (MarcoFalke) Pull request description: Motivation: * Some are not translated at all, anyway. See bitcoin#30267 (comment) * For others translation is not yet needed, because they are not called by the GUI (yet) * For others translations will never be needed, because they are RPC code. See bitcoin#30267 (comment) Also, while touching this: * Remove the trailing `\n`. See bitcoin#30267 (comment) * Add back the path. See bitcoin#30267 (comment) * Use named args to get the path. ACKs for top commit: fjahr: re-ACK fa5b892 tdb3: ACK fa5b892 ryanofsky: Code review ACK fa5b892 Tree-SHA512: 46504dc5fd55a6274ef885dbe071aa9efb25bca247cd68cd86fb2ff066d70d295e0522e1fe42e63f1fdf7e4c89bd696220edaf06e33b804aba746492eafd852e
…ent chain + test 5b7f70b test: loadtxoutset in divergent chain with less work d35efe1 p2p: Start downloading historical blocks from common ancestor Pull request description: When the active chain tip is not an ancestor of the snapshot base, the background chainstate must download the snapshot's history from the last common ancestor of its tip and the base, not from its own tip. Dash adaptations: - The divergent-chain node is a fifth node (n4): n3 is the node that drops its snapshot with -reindex-chainstate. It is authorized with the same -assumeutxodata pin as the other loading nodes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…_FAILED_CHILD assignment 0bd53d9 test: add test for getchaintips behavior with invalid chains (Martin Zumsande) ccd98ea test: cleanup rpc_getchaintips.py (Martin Zumsande) f5149dd validation: mark blocks building on an invalid block as BLOCK_FAILED_CHILD (Martin Zumsande) 783cb73 validation: call RecalculateBestHeader in InvalidChainFound (Martin Zumsande) 9275e96 rpc: call RecalculateBestHeader as part of reconsiderblock (Martin Zumsande) a51e917 validation: add RecalculateBestHeader() function (Martin Zumsande) Pull request description: `m_best_header` (the most-work header not known to be on an invalid chain) can be wrong in the context of invalidation / reconsideration of blocks. This can happen naturally (a valid header is received and stored in our block tree db; when the full block arrives, it is found to be invalid) or triggered by the user with the `invalidateblock` / `reconsiderblock` rpc. We don't currently use `m_best_header` for any critical things (see OP of bitcoin#16974 for a list that still seems up-to-date), so it being wrong affects mostly rpcs. This PR proposes to recalculate it if necessary by looping over the block index and finding the best header. It also suggest to mark headers between an invalidatetd block and the previous `m_best_header` as invalid, so they won't be considered in the recalculation. It adds tests to `rpc_invalidateblock.py` and `rpc_getchaintips.py` that fail on master. One alternative to this suggested in the past would be to introduce a continuous tracking of header tips (bitcoin#12138). While this might be more performant, it is also more complicated, and situations where we need this data are only be remotely triggerable by paying the cost of creating a valid PoW header for an invalid block. Therefore I think it isn't necessary to optimise for performance here, plus the solution in this PR doesn't perform any extra steps in the normal node operation where no invalidated blocks are encountered. Fixes bitcoin#26245 ACKs for top commit: fjahr: reACK 0bd53d9 achow101: ACK 0bd53d9 TheCharlatan: Re-ACK 0bd53d9 Tree-SHA512: 23c2fc42d7c7bb4f9b4ba4949646b3d0031dd29ed15484e436afd66cd821ed48e0f16a1d02f45477b5d0d73a006f6e81a56b82d9721e0dee2e924219f528b445
3c3548a validation: clarify final |= BLOCK_FAILED_VALID in InvalidateBlock (Matt Corallo) aac5488 validation: correctly update BlockStatus for invalid block descendants (stratospher) 9e29653 test: check BlockStatus when InvalidateBlock is used (stratospher) c996675 validation: fix traversal condition to mark BLOCK_FAILED_CHILD (stratospher) Pull request description: This PR addresses 3 issues related to how `BLOCK_FAILED_CHILD` is set: 1. In `InvalidateBlock()` - Previously, `BLOCK_FAILED_CHILD` was not being set when it should have been. - This was due to an incorrect traversal condition, which is fixed in this PR. 2. In `SetBlockFailure()` - `BLOCK_FAILED_VALID` is now cleared before setting `BLOCK_FAILED_CHILD`. 3. In `InvalidateBlock()` - if block is already marked as `BLOCK_FAILED_CHILD`, don't mark it as `BLOCK_FAILED_VALID` again. Also adds a unit test to check `BLOCK_FAILED_VALID` and `BLOCK_FAILED_CHILD` status in `InvalidateBlock()`. <details> <summary><h3>looking for feedback on an alternate approach</h3></summary> <br> An alternate approach could be removing `BLOCK_FAILED_CHILD` since even though we have a distinction between `BLOCK_FAILED_VALID` and `BLOCK_FAILED_CHILD` in the codebase, we don't use it for anything. Whenever we check for BlockStatus, we use `BLOCK_FAILED_MASK` which encompasses both of them. See similar discussion in bitcoin#16856. I have a branch with this approach in https://github.com/stratospher/bitcoin/commits/2025_02_remove_block_failed_child/. Compared to the version in bitcoin#16856, it also resets `BLOCK_FAILED_CHILD` already on disk to `BLOCK_FAILED_VALID` when loading from disk so that we won't be in a dirty state in a no-`BLOCK_FAILED_CHILD`-world. I'm not sure if it's a good idea to remove `BLOCK_FAILED_CHILD` though. would be curious to hear what others think of this approach. thanks @ mzumsande for helpful discussion regarding this PR! </details> ACKs for top commit: achow101: ACK 3c3548a TheCharlatan: Re-ACK 3c3548a mzumsande: re-ACK 3c3548a Tree-SHA512: 83e0d29dea95b97519d4868135c965b86f6f43be50b15c0bd8f998b3476388fc7cc22b49c0c54ec532ae8222e57dfc436438f0c8e98f54757b384f220488b6a6 Dash adaptations: - InvalidateBlock() keeps every invalidated block (or, after a stall, the last disconnected one) in m_failed_blocks, as this tree's header acceptance reads that set; upstream inserts only in the branch for a block that never was in the chain. - The unit test takes cs_main directly instead of ChainstateManager::GetMutex() and includes validation.h and consensus/validation.h, which this blockchain_tests.cpp did not include. - Follow-up to bitcoin#30666, ported earlier in this stack. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the best header chain 55b6d7b validation: Don't load a snapshot if it's not in the best header chain. Pull request description: Refuse a snapshot whose base is not an ancestor of the best known header: the node could not reorg away from it before background validation ends. Dash adaptations: - The check is the last one in SnapshotActivationRefusal(), so it runs at load and again under the cs_main hold of the switch. Headers of a more-work fork that arrive while the snapshot is populated are refused like those known before the load. Upstream checks only at load. The refusal is logged and returned like the other refusals, with upstream's message. - It takes the height from the base's block index entry, the form upstream reaches once bitcoin#30598 drops the height from the metadata. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y go to logs fa530ec rpc: Return precise loadtxoutset error messages (MarcoFalke) faa5c86 refactor: Use untranslated error message in ActivateSnapshot (MarcoFalke) Pull request description: The error messages should never happen in normal operation. However, if they do, they are helpful to return to the user to debug the issue. For example, to notice a truncated file. This fixes bitcoin#28621 Also includes a minor refactor commit. ACKs for top commit: fjahr: Code review ACK fa530ec ryanofsky: Code review ACK fa530ec, just adjusting error messages a little since last review. (Thanks!) Tree-SHA512: 224968c9b13d082ca2ed1f6a8fcc5f51ff16d6c96bd38c3679699505b54337b99cccaf7a8474391f6b11f9ccb101977b4e626898c1217eae95802e290cf105f1
…ore background chain 49d569c p2p: For assumeutxo, download snapshot chain before background chain 7a88551 p2p: Restrict downloading of blocks for snapshot chain Pull request description: Download the snapshot chain's blocks first by resetting the last common block of each peer to at least the snapshot base, and do not download from peers whose best chain lacks the snapshot base, since the node could not reorg to their chain before background validation ends. Upstream adds no test; the functional rows that sync a snapshot node from n0 cover the download order. Co-Authored-By: Claude Opus 5.5 <[email protected]>
00618e8 assumeutxo: Drop block height from metadata (Fabian Jahr) Pull request description: Fixes bitcoin#30514 which has more context and shows how the issue can be reproduced. Since the value in question is removed, there is no test to add to reproduce anything. This is an alternative approach to bitcoin#30516 with much of the [code being suggested there](bitcoin#30516 (comment)). ACKs for top commit: maflcko: re-ACK 00618e8 🎌 achow101: ACK 00618e8 theStack: Code-review ACK 00618e8 ismaelsadeeq: Re-ACK 00618e8 mzumsande: ACK 00618e8 Tree-SHA512: db9575247bae838ad7742a27a216faaf55bb11e022f9afdd05752bb09bbf9614717d0ad64304ff5722a16bf41d8dea888af544e4ae26dcaa528c1add0269a4a8
…operate on snapshot chainstate 917e70a test: assumeutxo: check that UTXO-querying RPCs operate on snapshot chainstate Pull request description: Inspired by some manual testing I did for bitcoin#28553, this PR checks that RPCs which explicitly query the UTXO set database (i.e. `gettxoutsetinfo`, `scantxoutset` and `gettxout`) operate on the snapshot chainstate as expected. Applies unchanged. In Dash both RPCs also flush the snapshot chainstate's Evo state from the RPC thread while the background chainstate runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… nodes during IBD 992f83b test: add coverage for assumeUTXO honest peers disconnection 6d5812e assumeUTXO: fix peers disconnection during sync Pull request description: A node with a snapshot chainstate advertised NODE_NETWORK although it cannot serve the blocks below the base, so IBD peers requested them, got no answer and disconnected it as stalling. loadtxoutset now replaces NODE_NETWORK with NODE_NETWORK_LIMITED, startup does not set NODE_NETWORK while background sync is in progress, and NODE_NETWORK returns when background validation completes (restart_indexes becomes snapshot_download_completed). Dash adaptations: - Snapshots are refused on pruned nodes here, so feature_assumeutxo.py's n1 is a full node: its checks expect NODE_NETWORK_LIMITED only while it is in dual mode and NODE_NETWORK again after completion, as for n2, instead of upstream's pruned-node checks. - The waits for NODE_NETWORK in test_sync_from_assumeutxo_node, after the base block is stored, and in the n2 row, after completion, are bitcoin#30880's 19f4a7c (test: Wait for local services to update in feature_assumeutxo), folded in here. The n1 row waits the same way: the callback that restores NODE_NETWORK runs after the step that disabled the background chainstate, which getchainstates can already reflect. - A snapshot rejected at completion does not restore NODE_NETWORK: the rejection requests a shutdown, and the next startup computes the service flags again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…re_assumeutxo 19f4a7c test: Wait for local services to update in feature_assumeutxo (Fabian Jahr) Pull request description: Closes bitcoin#30878 It seems like there is a race where the block is stored locally and `getblock` does not error anymore, but `ActivateBestChain` has not finished yet, so the local services are not updated yet either. Fix this by waiting for the local services to update. Can be reproduced locally by adding the sleep here: ```cpp ──────────────────────────────────────────────────────────────────────────────────────────────────────────┐ src/validation.cpp:3567: bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr< │ ──────────────────────────────────────────────────────────────────────────────────────────────────────────┘ } if (WITH_LOCK(::cs_main, return m_disabled)) { std::this_thread::sleep_for(std::chrono::seconds(10)); // Background chainstate has reached the snapshot base block, so exit. // Restart indexes to resume indexing for all blocks unique to the snapshot ``` ACKs for top commit: maflcko: review-only ACK 19f4a7c achow101: ACK 19f4a7c pablomartin4btc: tACK 19f4a7c furszy: Code review ACK [19f4a7c](bitcoin@19f4a7c). Tree-SHA512: 70dad3795988956c5e20f2d2d895fb56c5e3ce257c7547d3fd729c88949f0e24cb34594da1537bce8794ad02b2db44e7e46e995aa32539cd4dd84c4f1d4bb1c4
…or background chainstate c0a0c72 validation: Disable CheckForkWarningConditions for background chainstate Pull request description: The background chainstate's tip lags far behind, so comparing it with the best invalid block raised a fork warning for a fork that the active chain does not have. Dash adaptations: - feature_assumeutxo_dash.py's dual-mode scenario invalidates the block with the spend conflicting with an InstantSend lock and checks that the warnings lack "We do not appear to fully agree" after the background chainstate connected blocks below it. - As upstream until bitcoin#30214, the step that completes background validation reports NORMAL, so that one step still evaluates the condition; the next active step resets it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…_tx_count, Improve wallet RPC errors 9d2d9f7 rpc: Include assumeutxo as a failure reason of rescanblockchain 595edee test, assumeutxo: import descriptors during background sync d73ae60 rpc: Improve importdescriptor RPC error messages 27f99b6 validation: Don't assume m_chain_tx_count in GuessVerificationProgress 42d5d53 interfaces: Add helper function for wallet on pruning Pull request description: GuessVerificationProgress() can legitimately see a block without a transaction count, e.g. a wallet rescan below a snapshot base, so it returns 0 with a debug log instead of an Assume. importdescriptors and rescanblockchain name the assumeutxo background sync as the likely cause when blocks are unavailable. Dash adaptations: - 42d5d53 (Chain::getPruneHeight) is not ported: it needs GetPruneHeight() from bitcoin#29668, which this tree lacks. rescanblockchain therefore reports pruning whenever the node has pruned, as before; a node with a snapshot chainstate never prunes here, so the assumeutxo message is unaffected. - m_chain_tx_count is nChainTx in this tree; the log names dashd. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… successful 52482cb test: Check datadir cleanup after assumeutxo was successful (Fabian Jahr) Pull request description: I noticed that the proper datadir cleanup after a successful restart of an assumutxo node does not seem to be covered in our tests. This is added here. ACKs for top commit: l0rinc: utACK 52482cb mabu44: Re-ACK 52482cb Prabhat1308: re-ACK [`52482cb`](bitcoin@52482cb) TheCharlatan: Re-ACK 52482cb Tree-SHA512: cc941afeba250050eaccf5112255d961253fec9b2683545454a0d2fbe4d542178394b301d169a9dd79edbf6b5d478d95282727dbb0aca96ee79d4cd1ff80f19b
… promoted bitcoin#33604 is not adopted. Before the restart that promotes a validated snapshot, Dash cannot disconnect below the base's carried Evo state, so downloading from such peers only stalls and churns the chain. bitcoin#29519's refusal, which keys on the snapshot base, already lasts until promotion here, because no snapshot base exists after the promoting restart. Its test is replaced by this one. The snapshot node, validated but not yet restarted, still reports its snapshot base in getchainstates. It refuses a peer whose more-work chain forks below the base, without an Evo state error, and keeps its tip. The restart promotes it, so getchainstates no longer reports a snapshot base, and it then reorgs to that chain below the old base, through the validated chainstate's Evo state. The fork is mined to a fresh address: with the mock time fixed, the usual address would rebuild the block just invalidated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bitcoin#29519's download refusal only covers FindNextBlocksToDownload. A chain forking below the snapshot base still reaches the snapshot chainstate's candidates when its blocks arrive another way (direct fetch of a short fork, submitblock, blocks already on disk) once their parents below the base are linked, which the background chainstate's progress provides. The snapshot chainstate then disconnected its blocks down towards the base until it stalled on Evo state below the base that it does not have, before or after background validation reached the base, and reconnected them. FindMostWorkChain now passes over candidates that do not descend from the base while the snapshot chainstate's chain contains it. They stay in setBlockIndexCandidates, and after the restart that promotes the snapshot there is no base and the node follows them. The test submits a more-work chain forking below the base to a snapshot node whose background chainstate has not reached the base, and to one that has validated it; both keep their tip without disconnecting a block. After the promoting restart the node downloads a block of that chain it has not seen. Co-Authored-By: Claude Opus 5.5 <[email protected]>
5cd5794 test: verify node state after restart in assumeutxo Pull request description: Replace the TODO after the restart during background sync with checks of the chainstates and of wallet loading, which still needs the blocks below the snapshot. Dash adaptations: - The pruned-node rows that use the same error helper are absent: a node does not load snapshots with -prune in this tree. - A blank line precedes the nested helper, for this tree's flake8 (E306). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o.py faa68ed test: Fix intermittent issue in wallet_assumeutxo.py Pull request description: -stopatheight may let a few more blocks through during shutdown. Sync the node to the pause height with submitblock instead of restarting it, and unload the wallets so the loading checks still apply. Dash adaptations: - setup_network() keeps its form; the pruned-node rows are absent, as for bitcoin#34286. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…xo.py faf71d6 test: [refactor] Use verbosity=0 named arg 99996f6 test: Fix intermittent issue in feature_assumeutxo.py Pull request description: Sync n1 to the pause height with submitblock instead of a -stopatheight restart, which could stop a few blocks later than expected. Dash adaptations: - The blockfile segmentation checks between the two hunks are absent, as the segmentation is not part of this tree (bitcoin#27596's commit). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mainnet at height 2579482 and testnet at height 1599687, each with the UTXO set hash, the v4 evo section hash, the chain transaction count and the base block hash of a dumptxoutset run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…twork With pinned snapshots for mainnet and testnet, loadtxoutset is useful outside regtest. Drop the regtest-only guards of loadtxoutset and getchainstates and list them, together with dumptxoutset, in the blockchain category instead of hiding them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…testnet Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Init rejects -prune together with -reindex-chainstate, so the design doc must not offer that combination as a way to start a pruned node that has a snapshot chainstate. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Issue being fixed or feature implemented
The AssumeUTXO stack lets a node load a UTXO snapshot together with the Dash Evo state at its base, sync to the tip from there, and validate the history in the background. Until now it was usable only on regtest: mainnet and testnet had no
m_assumeutxo_dataentries, andloadtxoutsetandgetchainstatesrefused to run outside regtest. This PR pins one snapshot each for mainnet and testnet and makes the RPCs available there.AssumeUTXO stack (merge in this order; each PR holds the commits of the ones below it): #8078 → #8273 → #8079 → this PR (#8272 has merged). New on top of #8079: the four commits from
1c81e99de9(feat(chainparams): pin AssumeUTXO snapshots for mainnet and testnet) onwards, and one doc commit after them.Restack (2026-12-04). This PR now sits on the restacked #8079, on the per-chainstate Evo design that #8286 put on develop.
doc/design/assumeutxo.mdare updated. rpc: Optimize serialization and enhance metadata of dumptxoutset output bitcoin/bitcoin#29612 and assumeutxo: Drop block height from metadata bitcoin/bitcoin#30598, now in backport: bitcoin#29215, #29394, #29370, #29720, #29726, #30053, #29345, #29478, #29973, #29612, #30167, #29428, #30267, #30395, #29996, #30666, #30320, #30497, #29519, #30598, #30636, #30807, #30880, #30962, #30909, #32033, #34286, #34728, #34852 #8079, change the file format, so the old files no longer load.What was done?
src/kernel/chainparams.cpp: onem_assumeutxo_dataentry each for mainnet and testnet. Each entry has the base height, base block hash, UTXO set hash (hash_serialized), v4 Evo section hash (evo_hash) andnChainTx:000000000000001cfbe4751211d7e753bab093e5d63de1fa947cf20714a0e727, txoutset9f04690bf3ef7a4917eace719ac558cd6896a8bd22e905a74f19d76ce83d5811, evo5fe390df978e8e5ac259e02a0b0690a6e3a757f45177025cf5f4d864e59ebc6e, nChainTx 717390120000006e4b85a1f38f3224ead2865de8e7f29d98229b58b00a1b1bedab624872, txoutset4ba6fb243e38624fac1f2f434027b381c3cdf900f3da981e996d113be148d772, evo574ddf5486e18f81998b2a49a37b7ba9562ac4e134d14a7225bdd04b0c1b4afd, nChainTx 9019675src/rpc/blockchain.cpp:loadtxoutsetandgetchainstates, and the "regression testing only" sentences from their help.dumptxoutset,loadtxoutsetandgetchainstatesfrom thehiddencategory toblockchain.dumptxoutsethelp now says that its output can be loaded only if its height is pinned.-assumeutxodatastays regtest-only. It adds snapshot authorizations at runtime, so on mainnet or testnet it would let a user trust a snapshot nobody reviewed. Outside regtest, snapshot authorizations are reviewed chain parameters. The refusals for pruned nodes, masternodes, quorum watchers and-addressindex/-spentindex/-timestampindexalready apply on every network.doc/design/assumeutxo.md: the pinned heights, base hashes, file sizes and file sha256s, how to load a snapshot, and how to reproduce the pinned file. Release notedoc/release-notes-8276.md.Devnets get no pin; they are short-lived and their chains differ.
The last commit,
04496b52e1doc: pruning needs a full -reindex to discard a snapshot chainstate. Init rejects-prunewith-reindex-chainstate, so the design doc no longer offers that combination.How the values were verified (2026-12-04, this stack)
On each network, a fresh Release build of this stack's tip synced from genesis. Each node was then restarted with no peers, so that ChainLock enforcement could not undo the rollback. It ran
invalidateblockon the block after the base and dumped withdumptxoutset.000000000000001cfbe4…0727, txoutset9f04690b…5811, evo5fe390df…bc6e, nChainTx 71739012, 4513970 coins, 3006 masternodes. The file is 198291273 bytes, sha2563566d15ea5af0c4af58cae2b8d6a63ebfc7482b0ccdc5dd47c9982a01f1a2607.0000006e4b85…4872, txoutset4ba6fb24…d772, evo574ddf54…4afd, nChainTx 9019675, 996268 coins, 413 masternodes. The file is 53789664 bytes, sha25644bec37e5533eedc5e2940c87984ca50d5e6576e62a075b4994cff3d3c14c75e.Every value matches the pins. Loading the testnet file end to end:
loadtxoutsetwith the file; it loaded 996268 coins at the base.ERRORlines.protx list registered true Hat the base, base±1 and near the tip differed only in the node-localmetaInfocounters.Loading the mainnet file end to end gave the same result. A fresh node with only headers loaded 4513970 coins at the base, and background validation reached the base and validated the snapshot in about 74 minutes. A restart promoted the snapshot with no
ERRORlines in the log. The tip was the same as the source node's, andprotx list registered trueat the base and base+1 matched across all 3006 masternodes apart from the node-localmetaInfo.How Has This Been Tested?
validation_tests/test_assumeutxochecks that mainnet and testnet each have exactly the pinned entry: it looks the entry up by height and by block hash, and checks that the neighbouring heights have none.feature_assumeutxo_refusals.pystarts the node on mainnet and testnet without-assumeutxodata, and checks thatgetchainstatesanswers and that loading the regtest snapshot fails because its block hash is not recognized.-DWERROR=ON), the fulltest_dashpassed, and so didfeature_assumeutxo,feature_assumeutxo_dash,feature_assumeutxo_refusals,wallet_assumeutxoandrpc_dumptxoutset. At this head, which includes validation: set BLOCK_FAILED_CHILD correctly bitcoin/bitcoin#31835 and the moved assumeutxo: Don't load a snapshot if it's not in the best header chain bitcoin/bitcoin#30320 check from backport: bitcoin#29215, #29394, #29370, #29720, #29726, #30053, #29345, #29478, #29973, #29612, #30167, #29428, #30267, #30395, #29996, #30666, #30320, #30497, #29519, #30598, #30636, #30807, #30880, #30962, #30909, #32033, #34286, #34728, #34852 #8079, the fulltest_dashpasses, andblockchain_tests(including the newinvalidate_blockcase),validation_chainstatemanager_testsandvalidation_testspass, and so dofeature_assumeutxo,feature_assumeutxo_refusals,rpc_invalidateblockandfeature_llmq_is_cl_conflicts.Breaking Changes
loadtxoutsetandgetchainstatesnow work on mainnet and testnet. Before, they failed there with "... is for regression testing (-regtest mode) only".dumptxoutset,loadtxoutsetandgetchainstatesare listed inhelpunder Blockchain instead of being hidden.Checklist:
🤖 Generated with Claude Code