Add regression test for zallet BlockConflict recovery (zcash/zallet#556/#560)#151
Open
Cosmos-Harry wants to merge 1 commit into
Open
Add regression test for zallet BlockConflict recovery (zcash/zallet#556/#560)#151Cosmos-Harry wants to merge 1 commit into
Cosmos-Harry wants to merge 1 commit into
Conversation
…/#560) Verifies zallet doesn't crash and recovers via fork-point search when it hits a real, planted BlockConflict during scanning, on real regtest zebrad/zaino/zallet processes.
dannywillems
force-pushed
the
harry/zallet-block-conflict-test
branch
from
July 9, 2026 12:41
2efd43a to
b69eaa7
Compare
dannywillems
reviewed
Jul 9, 2026
| (conflict_height, fake_hash, *real_row), | ||
| ) | ||
| conn.commit() | ||
| finally: |
Contributor
There was a problem hiding this comment.
Nit: we should have a branch for the exception, just to detect exceptions that are raised. If an exception is raised, it will disappear in the finally branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
qa/rpc-tests/zallet_block_conflict.py, a regression test forzcash/zallet#556 /
zcash/zallet#560.
A
BlockConflict(the backend's block hash at a height disagreeing withwhat's already stored in the wallet's own database) must not crash the whole
wallet — it should search for the fork point and recover automatically
instead.
Closes zcash/zallet#564.
How it works
We can't reliably force this exact code path via a natural chain reorg —
zallet's own proactive fork-point check runs before every scan and already
resolves ordinary reorgs on its own, before a raw storage conflict could ever
occur.
Instead, this reproduces the bug the same way it was originally verified by
hand:
wallet.db, at aheight just ahead of its synced tip — cloning a real row's tree-state
columns so the only difference is the hash, avoiding an unrelated
deserialization error.
Everything else is real: real
zebrad, realzainod, realzallet, a realBlockConflictraised by the wallet's own conflict-detection logic, and areal recovery through the actual shipped fix.
Note
Depends on #150. This only runs successfully today because the
"zebra" chain backend (currently the launcher's default) explicitly
refuses to run on regtest, and this repo's default config/CI predates
zallet's launcher-plus-backend split. Locally I verified this test by
merging #150 (not included in this branch) to get the
zainobackendwired up. Once #150 merges to
main, this test should pass as-is; beforethat, it'll fail to start zallet for unrelated reasons this PR doesn't
touch. Happy to rebase/re-verify once #150 lands.
Test plan
zebrad/zainod/zallet(builtfrom the
zcash/zallet#560branch), all passing(
Block at height N conflicts with previously stored data...→Chain reorg detected, rewinding to...), not a crash