协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
bitcoin-testing-fuzz【开发与工程】Fuzz testing for Bitcoin code: Bitcoin Core's libFuzzer harnesses, rust-bitcoin / bdk / secp256k1 cargo-fuzz, AFL++. Seed corpus bootstrapping, regression tests. USE WHEN: hardening Bitcoin libraries, writing fuzz harnesses, reproducing fuzz-found crashes.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Fuzzing finds bugs by feeding randomly-generated inputs and watching for crashes / assertion failures. Critical for Bitcoin libraries parsing untrusted data (txs, scripts, P2P messages).
Located in src/test/fuzz/. Each .cpp file is one harness.
Bitcoin Core 29.0 (April 2025) replaced Autotools with CMake
(minimum 3.22): ./autogen.sh and ./configure are gone, and the
driver binary moved from src/test/fuzz/fuzz to build_fuzz/bin/fuzz.
Current as of Bitcoin Core 31.1 (July 2026):
# Build with fuzzing (preset sets BUILD_FOR_FUZZING=ON and
# SANITIZERS=undefined,address,fuzzer)
cmake --preset=libfuzzer
cmake --build build_fuzz
# Run a specific harness
FUZZ=tx_in build_fuzz/bin/fuzz <corpus_dir>
FUZZ=script build_fuzz/bin/fuzz <corpus_dir>
--preset=libfuzzer-nosan builds the same harnesses without the
address/undefined sanitizers into build_fuzz_nosan — far higher
throughput for long coverage-hunting runs.
afl++ and Honggfuzz bypass the presets: configure with
-DBUILD_FOR_FUZZING=ON and their compiler wrappers
(afl-clang-lto++, hfuzz-clang++), then drive build_fuzz/bin/fuzz
under afl-fuzz / honggfuzz.
Available targets: tx_in, tx_out, script, descriptor_parse,
miniscript_string, psbt, addrman, block_header, process_message, etc.
build_fuzz/test/fuzz/test_runner.py executes them all.
Use cargo-fuzz:
cd rust-bitcoin/fuzz
cargo +nightly fuzz run script_decode
Each fuzz_targets/*.rs is a separate target.
Native libFuzzer harnesses; verify against test vectors first, then random.
bitcoin-core/qa-assets — one directory per harness under
fuzz_corpora/, token dictionaries under fuzz_dicts/ (as of
September 2026).libFuzzer / AFL++ instrument code with branch coverage. New inputs that exercise new branches are kept, expanding coverage.
Effective for:
OSS-Fuzz and Bitcoin Core's own farms run continuous fuzzing 24/7. Findings reported privately; fixed before public disclosure.