mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:50:37 +00:00
WIP: fuzz: wallet: add target for tx scanning #32993
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!32993
Loading…
Reference in a new issue
No description provided.
Delete branch "2025-06-fuzz-wallet-scan"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tracking issue (#29901)
This PR adds a fuzz target for wallet tx scanning (
ScanForWalletTransactions). Unfortunately, it's not a regression test for the issue #31474 since it would require a more complex scenario/async operations.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.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
No conflicts as of last run.
LLM Linter (✨ experimental)
Possible places where named args for integral literals may be used (e.g.
func(x, /*named_arg=*/0)in C++, andfunc(x, named_arg=0)in Python):InitBlockFilterIndex([&]{ return interfaces::MakeChain(g_setup->m_node); }, BlockFilterType::BASIC, 1 << 20, true, false)insrc/wallet/test/fuzz/scan.cpp2026-06-12 18:43:50
🚧 At least one of the CI tasks failed.
Task
fuzzer,address,undefined,integer, no depends: https://github.com/bitcoin/bitcoin/runs/46096767347LLM reason (✨ experimental): Fuzzer crash caused by signed integer overflow in chrono.h during fuzzing process.
Hints
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
https://cirrus-ci.com/task/4897452429410304?logs=ci#L6267:
Fixed, thanks.
tACK 747d094
The target runs without crashing.
tested 747d0942413, left two comments.
The ASan crash is not a target crash since it happens after fuzzing is done, but should be addressed before merge, I think. Could be that I'm misreading the importance of it, though.
I found an input with an ASan crash after fuzzing is done:
FUZZ=wallet_scan build_fuzz/bin/fuzz -runs=1 fuzz_corpora/wallet_scan/386f79ce03c75ae120f5680cb3d0a9bcf263eec2
I think it happens when
InitBlockFilterIndex()at line 52 runs, butDestroyAllBlockFilterIndexes()here doesn't. This input doesn't crash anymore when I unconditionally callDestroyAllBlockFilterIndexes()at the end:patch
Not sure if that's an appropriate patch, though.
nit: Is this branch needed? I don't think it leads to increased coverage somewhere.
AbortRescan()runsfAbortRescan = true, butScanForWalletTransactions()will runfAbortRescan = falsebefore scanning.No, it's a no-op, leftover from other thing I was trying. Will remove, thank you.
Nice catch, it's correct. We should call
DestroyAllBlockFilterIndexes()at the end of the iteration. It clears the g_filter_indexes registry that lives outside the per-iteration TestingSetup, so the filter index doesn't survive into the next fuzz iteration.🚧 At least one of the CI tasks failed.
Task
lint: https://github.com/bitcoin/bitcoin/actions/runs/27434430642/job/81092671475LLM reason (✨ experimental): CI failed because the lint step detected forbidden
fs::remove_allusage (remove_all check) insrc/wallet/test/fuzz/scan.cpp.Hints
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
Force-pushed:
fs::remove_allBlockCreateOptionsI just moved it to draft because I want to refactor some stuff here to make it more efficient (current avg exec/s is far from being good).
What's the status here? Are you still working on this?
🟠 Minor · The empty block-filter index leaves filter-result paths unreachable
The index-enabled branch of
wallet_scanonly registers an empty index, so every filter lookup returnsstd::nulloptand neither matching-filter handling nor nonmatching-block skipping is exercised.Location:
src/wallet/test/fuzz/scan.cpp:51(head).🔵 Suggestion · Scan inputs do not deliberately pair
start_blockwith its heightwallet_scanchoosesstart_heightindependently ofstart_block, producing inconsistent scan ranges without deliberately exercising coherent non-genesis starts.Location:
src/wallet/test/fuzz/scan.cpp:102(head).🔵 Suggestion · Always-engaged
max_heightexcludes the mempool scanwallet_scanalways passes anintasmax_height, so it never exercises the unbounded mode or its post-loop mempool phase.Location:
src/wallet/test/fuzz/scan.cpp:103(head).Review coverage was incomplete.
Reviewed:
fbeba67512b3· Review report · Previous reportspermalink
Closing for now. working on other stuff.