Skip to content

Commit 708103a

Browse files
committed
update fuzz generator
1 parent 85550fb commit 708103a

4 files changed

Lines changed: 39 additions & 33 deletions

File tree

.github/workflows/fuzz.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
fuzz_target: [
26-
dash_outpoint_string,
2726
dash_deserialize_amount,
2827
# TODO fix the inputs placed in fuzz/hfuzz_input/deserialize_transaction/input
2928
# dash_deserialize_transaction,
@@ -33,15 +32,16 @@ jobs:
3332
# dash_deserialize_prefilled_transaction,
3433
dash_deserialize_witness,
3534
# dash_deserialize_psbt,
36-
dash_deserialize_block,
35+
dash_outpoint_string,
3736
dash_deserialize_script,
37+
dash_deserialize_block,
38+
hashes_sha1,
39+
hashes_sha256,
40+
hashes_sha512,
3841
hashes_json,
3942
hashes_cbor,
40-
hashes_sha256,
4143
hashes_ripemd160,
4244
hashes_sha512_256,
43-
hashes_sha512,
44-
hashes_sha1,
4545
]
4646
steps:
4747
- name: Install test dependencies

fuzz/Cargo.toml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,13 @@ serde_json = "1.0"
2828
serde_cbor = "0.11"
2929

3030
[[bin]]
31-
name = "dash_outpoint_string"
32-
path = "fuzz_targets/dash/outpoint_string.rs"
31+
name = "dash_deserialize_prefilled_transaction"
32+
path = "fuzz_targets/dash/deserialize_prefilled_transaction.rs"
3333

3434
[[bin]]
3535
name = "dash_deserialize_amount"
3636
path = "fuzz_targets/dash/deserialize_amount.rs"
3737

38-
[[bin]]
39-
name = "dash_deserialize_transaction"
40-
path = "fuzz_targets/dash/deserialize_transaction.rs"
41-
4238
[[bin]]
4339
name = "dash_deser_net_msg"
4440
path = "fuzz_targets/dash/deser_net_msg.rs"
@@ -51,25 +47,41 @@ path = "fuzz_targets/dash/deserialize_address.rs"
5147
name = "dash_script_bytes_to_asm_fmt"
5248
path = "fuzz_targets/dash/script_bytes_to_asm_fmt.rs"
5349

54-
[[bin]]
55-
name = "dash_deserialize_prefilled_transaction"
56-
path = "fuzz_targets/dash/deserialize_prefilled_transaction.rs"
57-
5850
[[bin]]
5951
name = "dash_deserialize_witness"
6052
path = "fuzz_targets/dash/deserialize_witness.rs"
6153

54+
[[bin]]
55+
name = "dash_outpoint_string"
56+
path = "fuzz_targets/dash/outpoint_string.rs"
57+
58+
[[bin]]
59+
name = "dash_deserialize_transaction"
60+
path = "fuzz_targets/dash/deserialize_transaction.rs"
61+
6262
[[bin]]
6363
name = "dash_deserialize_psbt"
6464
path = "fuzz_targets/dash/deserialize_psbt.rs"
6565

66+
[[bin]]
67+
name = "dash_deserialize_script"
68+
path = "fuzz_targets/dash/deserialize_script.rs"
69+
6670
[[bin]]
6771
name = "dash_deserialize_block"
6872
path = "fuzz_targets/dash/deserialize_block.rs"
6973

7074
[[bin]]
71-
name = "dash_deserialize_script"
72-
path = "fuzz_targets/dash/deserialize_script.rs"
75+
name = "hashes_sha1"
76+
path = "fuzz_targets/hashes/sha1.rs"
77+
78+
[[bin]]
79+
name = "hashes_sha256"
80+
path = "fuzz_targets/hashes/sha256.rs"
81+
82+
[[bin]]
83+
name = "hashes_sha512"
84+
path = "fuzz_targets/hashes/sha512.rs"
7385

7486
[[bin]]
7587
name = "hashes_json"
@@ -79,22 +91,10 @@ path = "fuzz_targets/hashes/json.rs"
7991
name = "hashes_cbor"
8092
path = "fuzz_targets/hashes/cbor.rs"
8193

82-
[[bin]]
83-
name = "hashes_sha256"
84-
path = "fuzz_targets/hashes/sha256.rs"
85-
8694
[[bin]]
8795
name = "hashes_ripemd160"
8896
path = "fuzz_targets/hashes/ripemd160.rs"
8997

9098
[[bin]]
9199
name = "hashes_sha512_256"
92100
path = "fuzz_targets/hashes/sha512_256.rs"
93-
94-
[[bin]]
95-
name = "hashes_sha512"
96-
path = "fuzz_targets/hashes/sha512.rs"
97-
98-
[[bin]]
99-
name = "hashes_sha1"
100-
path = "fuzz_targets/hashes/sha1.rs"

fuzz/fuzz-util.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22

33
REPO_DIR=$(git rev-parse --show-toplevel)
44

5-
listTargetFiles() {
5+
listAllTargetFiles() {
66
pushd "$REPO_DIR/fuzz" > /dev/null || exit 1
7-
find fuzz_targets -type f -name "*.rs" \
8-
| grep -v 'deserialize_transaction\|deserialize_prefilled_transaction\|deserialize_psbt'
7+
# List dash targets first, then hashes
8+
find fuzz_targets/dash -type f -name "*.rs" 2>/dev/null
9+
find fuzz_targets/hashes -type f -name "*.rs" 2>/dev/null
910
popd > /dev/null || exit 1
1011
}
1112

13+
listTargetFiles() {
14+
# Exclude targets that don't work in CI
15+
listAllTargetFiles | grep -v 'deserialize_transaction\|deserialize_prefilled_transaction\|deserialize_psbt'
16+
}
17+
1218
targetFileToName() {
1319
echo "$1" \
1420
| sed 's/^fuzz_targets\///' \

fuzz/generate-files.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ serde_json = "1.0"
3939
serde_cbor = "0.11"
4040
EOF
4141

42-
for targetFile in $(listTargetFiles); do
42+
for targetFile in $(listAllTargetFiles); do
4343
targetName=$(targetFileToName "$targetFile")
4444
cat >> "$REPO_DIR/fuzz/Cargo.toml" <<EOF
4545

0 commit comments

Comments
 (0)