File tree 4 files changed +43
-1
lines changed
4 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 19
19
# over that limit with fuzzing because of the hour run time.
20
20
fuzz_target : [
21
21
compile_descriptor,
22
+ compile_taproot,
22
23
parse_descriptor,
23
24
parse_descriptor_secret,
24
25
roundtrip_concrete,
Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ regex = "1.0"
19
19
name = " compile_descriptor"
20
20
path = " fuzz_targets/compile_descriptor.rs"
21
21
22
+ [[bin ]]
23
+ name = " compile_taproot"
24
+ path = " fuzz_targets/compile_taproot.rs"
25
+
22
26
[[bin ]]
23
27
name = " parse_descriptor"
24
28
path = " fuzz_targets/parse_descriptor.rs"
Original file line number Diff line number Diff line change
1
+ #![ allow( unexpected_cfgs) ]
2
+
3
+ use std:: str:: FromStr ;
4
+
5
+ use honggfuzz:: fuzz;
6
+ use miniscript:: { policy, Miniscript , Tap } ;
7
+ use policy:: Liftable ;
8
+
9
+ type Script = Miniscript < String , Tap > ;
10
+ type Policy = policy:: Concrete < String > ;
11
+
12
+ fn do_test ( data : & [ u8 ] ) {
13
+ let data_str = String :: from_utf8_lossy ( data) ;
14
+ if let Ok ( pol) = Policy :: from_str ( & data_str) {
15
+ // Compile
16
+ if let Ok ( desc) = pol. compile :: < Tap > ( ) {
17
+ // Lift
18
+ assert_eq ! ( desc. lift( ) . unwrap( ) . sorted( ) , pol. lift( ) . unwrap( ) . sorted( ) ) ;
19
+ // Try to roundtrip the output of the compiler
20
+ let output = desc. to_string ( ) ;
21
+ if let Ok ( desc) = Script :: from_str ( & output) {
22
+ let rtt = desc. to_string ( ) ;
23
+ assert_eq ! ( output. to_lowercase( ) , rtt. to_lowercase( ) ) ;
24
+ } else {
25
+ panic ! ( "compiler output something unparseable: {}" , output)
26
+ }
27
+ }
28
+ }
29
+ }
30
+
31
+ fn main ( ) {
32
+ loop {
33
+ fuzz ! ( |data| {
34
+ do_test( data) ;
35
+ } ) ;
36
+ }
37
+ }
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ publish = false
22
22
cargo-fuzz = true
23
23
24
24
[dependencies]
25
- honggfuzz = { version = "0.5.55 ", default-features = false }
25
+ honggfuzz = { version = "0.5.56 ", default-features = false }
26
26
miniscript = { path = "..", features = [ "compiler" ] }
27
27
28
28
regex = "1.0"
You can’t perform that action at this time.
0 commit comments