feat: add initial fuzz testing infrastructure (closes #61)#475
Open
soloking1412 wants to merge 1 commit intobitcoindevkit:masterfrom
Open
feat: add initial fuzz testing infrastructure (closes #61)#475soloking1412 wants to merge 1 commit intobitcoindevkit:masterfrom
soloking1412 wants to merge 1 commit intobitcoindevkit:masterfrom
Conversation
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.
Description
Adds initial fuzz testing infrastructure to address #61. Built around
cargo-fuzz(LibFuzzer), with three focused targets and CI integration.New
fuzz/crate with three targets:apply_update— structure-aware fuzzing ofWallet::apply_update. Generates arbitrary transactions, confirmation anchors, mempool timestamps, and chain checkpoints using theArbitraryderive macro. After each run, asserts that the total wallet balance doesn't exceed 21M BTC.create_tx— seeds the wallet with a known 100k-sat UTXO, then drivesbuild_txwith arbitrary fee rates, amounts, drain mode, RBF signalling, and signing.CreateTxErrorvariants are expected and swallowed — panics are bugs.descriptor_parse— feeds arbitrary byte strings throughIntoWalletDescriptorfor bothNetworkKind::MainandNetworkKind::Test. Exercises the full descriptor parsing pipeline: miniscript type-checking, key path validation, checksum verification.Shared helpers (
create_wallet,funding_update,p2wpkh_script) live infuzz/src/lib.rsto keep new targets clean.CI:
fuzz/is a workspace member but excluded from all normalcargo build/test/clippy/docruns so MSRV and no-std checks aren't affected.fuzz.ymlworkflow builds all targets on every PR (catches compile regressions) and runs each for 60 seconds on a weekly schedule, uploading crash artifacts on failure.Running locally: