From 574523dbe030f5fb8aca4d7fd41cdc304bd913d3 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Wed, 22 Feb 2023 16:28:58 +0100 Subject: [PATCH] fuzz: adapt Miniscript targets to Tapscript We introduce another global that dictates the script context under which to operate when running the target. For miniscript_script, just consume another byte to set the context. This should only affect existing seeds to the extent they contain a CHECKMULTISIG. However it would not invalidate them entirely as they may contain a NUMEQUAL or a CHECKSIGADD, and this still exercises a bit of the parser. For miniscript_string, reduce the string size by one byte and use the last byte to determine the context. This is the change that i think would invalidate the lowest number of existing seeds. For miniscript_stable, we don't want to invalidate any seed. Instead of creating a new miniscript_stable_tapscript, simply run the target once for P2WSH and once for Tapscript (with the same seed). For miniscript_smart, consume one byte before generating a pseudo-random node to set the context. We have less regard for seed stability for this target anyways. --- src/test/fuzz/miniscript.cpp | 281 ++++++++++++++++++++++++----------- 1 file changed, 195 insertions(+), 86 deletions(-) diff --git a/src/test/fuzz/miniscript.cpp b/src/test/fuzz/miniscript.cpp index 1268e01e98a..eca79f65e69 100644 --- a/src/test/fuzz/miniscript.cpp +++ b/src/test/fuzz/miniscript.cpp @@ -7,6 +7,7 @@ #include #include