#32993 fuzz: wallet: add target for tx scanning
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #32993 fuzz: wallet: add target for tx scanning | Author silent 142d | 0 (+1) | Strong | 0 + 111 tests | |||
|
|
|
|
| |||
Reviewability: ReadyStalePaused Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs. Size: lines added or modified outside tests, then in tests; greener = smaller. | |||||||
Goal
Add a new fuzz target, `wallet_scan`, covering the wallet's `ScanForWalletTransactions` interface. The target builds a mock chain containing fuzzed blocks and transactions with wallet scripts, toggles basic block filter indexing, and calls rescan with fuzzed start blocks and height boundaries.
Problem: Wallet transaction scanning lacked dedicated fuzz testing coverage, leaving edge cases in block processing, block filter usage, and height boundary handling in `ScanForWalletTransactions` undiscovered by automated fuzzing.
Evidence of importance:
- Addresses part of the wallet fuzzing tracking issue #29901.
- Author notes the test does not reproduce crash issue #31474 ('Potential crash (assert) rescanning wallet') because reproducing that requires complex asynchronous operations.
Scope: Adds a standalone test file `src/wallet/test/fuzz/scan.cpp` and hooks it into CMake.
Reviewability
Stale · Author silent 142d
No author activity for 142 days; a review may wait a long time for a response.
Agreement
Strong
substantive support, no open objection (Chand-ra)
Thread notes: Initial record. Added CI UBSan failure reported by fanquake and ASan heap-use-after-free reported by ekzyis; both were resolved by fixes pushed by the author. ekzyis's nit on AbortRescan was treated as style/cleanup and addressed.
Objections, suggestions, and questions:
| Reviewer | Type | Harm, request, or question | Status | Must be | Author replied | Quote |
|---|---|---|---|---|---|---|
| fanquake (member) | objection, correctness | UBSan signed integer overflow in std::chrono duration cast during fuzzing | fixed · fix pushed · v1, not yet re-checked | answered | yes | 2025-07-16: 'runtime error: signed integer overflow: -9223372036854775808 * 1000000000 cannot be represented in type 'long'' Status from: 2025-07-16: brunoerg: 'Fixed, thanks.' |
| ekzyis (none) | objection, safety | ASan heap-use-after-free crash on exit when block filter indexes are not destroyed | fixed · fix pushed · v1, not yet re-checked | changed | yes | 2026-06-12: 'I found an input with an ASan crash *after* fuzzing is done: ... ERROR: AddressSanitizer: heap-use-after-free' Status from: 2026-06-12: brunoerg: 'Addressed: https://github.com/bitcoin/bitcoin/pull/32993#discussion_r3404019071 and https://github.com/bitcoin/bitcoin/pull/32993#discussion_r3404753306' |
Support:
- Chand-ra (none) (Tested ACK, 2025-12-06): The target runs without crashing.
Participants:
- fanquake (member, objection, 1 statements 2025-07-16 to 2025-07-16): reported UBSan signed-integer overflow in CI
- Chand-ra (none, support, 1 statements 2025-12-06 to 2025-12-06): tested ACK that the fuzz target runs without crashing
- ekzyis (none, objection, 3 statements 2026-06-12 to 2026-06-12): reported ASan heap-use-after-free on shutdown and questioned an unnecessary AbortRescan call
Files
111 lines under test/bench/ci.
- src/wallet/test/fuzz/scan.cpp +110/-0
- src/wallet/test/fuzz/CMakeLists.txt +1/-0
Card
The short text the ranking pass compares across PRs.
Adds a new fuzz target covering wallet transaction scanning via ScanForWalletTransactions. The target constructs chains of fuzzed blocks and transactions directed to the wallet, optionally enables basic block filters, and executes rescans across randomized heights and block hashes. This expands coverage under the wallet fuzzing tracking issue #29901, though the author notes it does not reproduce the async rescan crash reported in #31474.
Data
thread read through 2026-06-12 (10 statements), head fbeba67512
Discussion read under schema 1 rules: suggestions and questions may be missing, and an objection may combine several harms (schema history).
labels: Tests, Fuzzing · draft
Categories
Wallet
P3 · test coverage (ranking pass: Moved down: useful coverage, but it does not reproduce the known rescan crash, so it ranks below behavior-affecting work.)
Adds dedicated fuzz testing for wallet rescanning edge cases. While it addresses part of tracking issue #29901, the author notes it does not reproduce known crash issue #31474, making this valuable test coverage that is reasonably deferrable.
Membership: Adds `src/wallet/test/fuzz/scan.cpp` to exercise `ScanForWalletTransactions` and rescanning logic.
Factors: security/stability 1, bug 0, performance 0, user value 0, leverage 0