test: Kill validation mutants #36827

Open
Zeegaths wants to merge 2 commits from kill-validation-mutants into master AGit
Zeegaths commented 2026-11-10 14:27:11 +00:00 (Migrated from github.com)

This PR kills 3 mutants from https://mutanthub.space/mutants in validation.cpp
I batched them together because the assertions are within the same test

Mutants killed:

Mutant 4388: validation.cpp ActivateBestChains, && → ||

@@ -6482,7 +6482,7 @@ util::Result<void> ChainstateManager::ActivateBestChains()
         for (const auto& chainstate : m_chainstates) {
-            if (chainstate && chainstate->m_assumeutxo != Assumeutxo::INVALID && !chainstate->m_target_utxohash) {
+            if (chainstate || chainstate->m_assumeutxo != Assumeutxo::INVALID && !chainstate->m_target_utxohash) {
                 chainstates.push_back(chainstate.get());

Mutant 4385: validation.cpp GetPruneRange, + 1 → - 1

@@ -6447,7 +6447,7 @@ std::pair<int, int> Chainstate::GetPruneRange(int last_height_can_prune) const
-        prune_start = Assert(SnapshotBase())->nHeight + 1;
+        prune_start = Assert(SnapshotBase())->nHeight - 1;

Mutant 4386: validation.cpp GetPruneRange, - → + MIN_BLOCKS_TO_KEEP

@@ -6451,7 +6451,7 @@ std::pair<int, int> Chainstate::GetPruneRange(int last_height_can_prune) const
     int max_prune = std::max<int>(
-        0, m_chain.Height() - static_cast<int>(MIN_BLOCKS_TO_KEEP));
+        0, m_chain.Height() + static_cast<int>(MIN_BLOCKS_TO_KEEP));
This PR kills 3 mutants from https://mutanthub.space/mutants in validation.cpp I batched them together because the assertions are within the same test Mutants killed: Mutant 4388: validation.cpp ActivateBestChains, && → || ```diff @@ -6482,7 +6482,7 @@ util::Result<void> ChainstateManager::ActivateBestChains() for (const auto& chainstate : m_chainstates) { - if (chainstate && chainstate->m_assumeutxo != Assumeutxo::INVALID && !chainstate->m_target_utxohash) { + if (chainstate || chainstate->m_assumeutxo != Assumeutxo::INVALID && !chainstate->m_target_utxohash) { chainstates.push_back(chainstate.get()); ``` Mutant 4385: validation.cpp GetPruneRange, + 1 → - 1 ```diff @@ -6447,7 +6447,7 @@ std::pair<int, int> Chainstate::GetPruneRange(int last_height_can_prune) const - prune_start = Assert(SnapshotBase())->nHeight + 1; + prune_start = Assert(SnapshotBase())->nHeight - 1; ``` Mutant 4386: validation.cpp GetPruneRange, - → + MIN_BLOCKS_TO_KEEP ```diff @@ -6451,7 +6451,7 @@ std::pair<int, int> Chainstate::GetPruneRange(int last_height_can_prune) const int max_prune = std::max<int>( - 0, m_chain.Height() - static_cast<int>(MIN_BLOCKS_TO_KEEP)); + 0, m_chain.Height() + static_cast<int>(MIN_BLOCKS_TO_KEEP)); ```
DrahtBot commented 2026-11-10 14:27:22 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK brunoerg, ViniciusCestarii

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #37094 (validation: validate assumeutxo snapshots with a single chainstate by fjahr)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36827 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36827.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36827#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [brunoerg](https://github.com/bitcoin/bitcoin/pull/36827#pullrequestreview-5846064779), [ViniciusCestarii](https://github.com/bitcoin/bitcoin/pull/36827#pullrequestreview-5847980907) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#37094](https://github.com/bitcoin/bitcoin/pull/37094) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/37094.svg"></sub> (validation: validate assumeutxo snapshots with a single chainstate by fjahr) If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. <!--5faf32d7da4f0f540f40219e4f7537a3-->
fanquake commented 2026-11-10 14:28:06 +00:00 (Migrated from github.com)

cc @brunoerg

cc @brunoerg
sedited commented 2026-11-10 14:53:25 +00:00 (Migrated from github.com)

Can you drop all those html tags in the PR description? It makes it hard to read anywhere else.

Can you drop all those html tags in the PR description? It makes it hard to read anywhere else.
First-time contributor

No verified findings are available from this review.

Review coverage was incomplete.


Reviewed: 190f103a63b0 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:7eebed8027c96ac27bcd79eeb7a88e35799cd96eb8fbacf34d3257986a959f64:cdc1bd61213c9363d5bb4c7b7ee073ccfd6fecdafbb2c4c18d9d9e031a6afcf8 --> <!-- ralph-base:0b9c2c30bfa343af7c0ffa8bf49a3a0c6e7b5121 --> <!-- ralph-head:190f103a63b026d11a1ec90dd42133a910a2dce2 --> <!-- ralph-case:9011a73c1f1fb47e9c55b96dda067b61052da3c77f7ebd68cc92758ff3654839 --> No verified findings are available from this review. Review coverage was incomplete. <!-- Review tier: routine --> --- Reviewed: [`190f103a63b0`](<https://git.fish.foo/bitcoin/bitcoin/commit/190f103a63b026d11a1ec90dd42133a910a2dce2>) · [Review report](<https://review.fish.foo/report/36827-190f103a63b026d11a1ec90dd42133a910a2dce2-2458-1.html>) · [Previous reports](<https://review.fish.foo/traces/36827/>) [permalink](<https://review.fish.foo/report/36827-190f103a63b026d11a1ec90dd42133a910a2dce2-2458-1.html>)
Zeegaths commented 2026-11-10 15:06:41 +00:00 (Migrated from github.com)

Can you drop all those html tags in the PR description? It makes it hard to read anywhere else.

done

> Can you drop all those html tags in the PR description? It makes it hard to read anywhere else. done
maflcko commented 2026-11-10 16:42:34 +00:00 (Migrated from github.com)
Moved CI failure to https://github.com/bitcoin/bitcoin/issues/36828
brunoerg (Migrated from github.com) approved these changes 2026-11-10 17:07:10 +00:00
brunoerg (Migrated from github.com) left a comment

lgtm ACK 190f103a63

verified these cases kill the mutants. left one nit (feel free to ignore)

lgtm ACK 190f103a63b026d11a1ec90dd42133a910a2dce2 verified these cases kill the mutants. left one nit (feel free to ignore)
brunoerg (Migrated from github.com) reviewed 2026-11-10 17:08:03 +00:00
brunoerg (Migrated from github.com) commented 2026-11-10 17:08:03 +00:00

nit: I'd add a comment explaining these expected numbers. 111 only makes sense if you know the snapshot base is at 110, for example.

nit: I'd add a comment explaining these expected numbers. 111 only makes sense if you know the snapshot base is at 110, for example.
ViniciusCestarii (Migrated from github.com) reviewed 2026-11-10 19:23:06 +00:00
ViniciusCestarii (Migrated from github.com) left a comment

ACK 190f103a63

Nice! Verified it kills the mutants.

ACK 190f103a63b026d11a1ec90dd42133a910a2dce2 Nice! Verified it kills the mutants.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36827
No description provided.