@@ -214,6 +214,11 @@ jobs:
214214 - name : Install cargo-fuzz
215215 run : cargo install cargo-fuzz
216216
217+ - name : Clone fuzzing corpus
218+ run : |
219+ git clone --depth=1 https://github.com/bitcoin-core/qa-assets /tmp/qa-assets
220+ echo "QA_ASSETS_DIR=/tmp/qa-assets" >> $GITHUB_ENV
221+
217222 - name : Set up fuzzing directories
218223 run : |
219224 mkdir -p /tmp/rust_kernel_fuzz
@@ -226,10 +231,27 @@ jobs:
226231 run : |
227232 # First compile the main crate with sanitizer flags
228233 cargo build --verbose
229- # Now build and run the fuzzing targets with the same sanitizer flags
234+
235+ # Now build all fuzz targets
230236 cargo fuzz build fuzz_target_block_deserialize
231237 cargo fuzz build fuzz_target_chainman
232238 cargo fuzz build fuzz_target_verify
233- cargo fuzz run fuzz_target_verify -- -max_total_time=20
234- cargo fuzz run fuzz_target_chainman -- -max_total_time=20
235- cargo fuzz run fuzz_target_block_deserialize -- -max_total_time=20
239+
240+ # Define target to corpus mapping
241+ declare -A CORPUS_MAP=(
242+ ["fuzz_target_block_deserialize"]="block_deserialize"
243+ ["fuzz_target_verify"]=""
244+ ["fuzz_target_chainman"]=""
245+ )
246+
247+ # Run each target with its corpus if available
248+ for target in "${!CORPUS_MAP[@]"; do
249+ corpus="${CORPUS_MAP[$target]}"
250+ if [ -n "$corpus" ] && [ -d "QA_ASSETS_DIR/fuzz_corpora/$corpus" ]; then
251+ echo "Running $target with corpus $corpus"
252+ cargo fuzz run $target "$QA_ASSETS_DIR/fuzz_corpora/$corpus" -- -max_total_time=20
253+ else
254+ echo "Running $target without corpus"
255+ cargo fuzz run $target -- -max_total_time=20
256+ fi
257+ done
0 commit comments