1919 SnarkjsSubprocess ,
2020 ZkRegexSubprocess ,
2121)
22+ from zkregex_fuzzer .runner .subprocess import BarretenbergSubprocess , NoirSubprocess
2223
2324
2425def fuzz_parser ():
@@ -50,6 +51,11 @@ def fuzz_parser():
5051 choices = list (VALID_INPUT_GENERATORS .keys ()),
5152 help = f"The valid input generator to use for the fuzzer (options: { list (VALID_INPUT_GENERATORS .keys ())} )." ,
5253 )
54+ parser .add_argument (
55+ "--seed" ,
56+ default = str (uuid .uuid4 ()),
57+ help = "Seed for random generator (default: UUIDv4)" ,
58+ )
5359 parser .add_argument (
5460 "--save" ,
5561 choices = [status .name for status in HarnessStatus ],
@@ -75,7 +81,7 @@ def fuzz_parser():
7581 help = "Maximum depth of recursion in the grammar (default: 5)." ,
7682 )
7783 parser .add_argument (
78- "--circom- max-input-size" ,
84+ "--max-input-size" ,
7985 type = int ,
8086 default = 600 ,
8187 help = "Maximum size of the circuit input (default: 600)." ,
@@ -99,6 +105,19 @@ def fuzz_parser():
99105 help = "Path to the ptau (powers-of-tau) file for the proving step" ,
100106 )
101107
108+ parser .add_argument (
109+ "--noir-prove" ,
110+ action = "store_true" ,
111+ help = "Run the proving and verification step with Barretenberg." ,
112+ )
113+
114+ parser .add_argument (
115+ "--logger-level" ,
116+ choices = ["DEBUG" , "INFO" , "WARNING" , "ERROR" , "CRITICAL" ],
117+ default = "INFO" ,
118+ help = "Set the logger level (default: INFO)." ,
119+ )
120+
102121 return parser
103122
104123
@@ -112,6 +131,12 @@ def reproduce_parser():
112131 help = "Path to the target directory output that want to be reproduced (support wildcard pattern)." ,
113132 required = True ,
114133 )
134+ parser .add_argument (
135+ "--logger-level" ,
136+ choices = ["DEBUG" , "INFO" , "WARNING" , "ERROR" , "CRITICAL" ],
137+ default = "INFO" ,
138+ help = "Set the logger level (default: INFO)." ,
139+ )
115140
116141 return parser
117142
@@ -123,13 +148,15 @@ def do_fuzz(args):
123148
124149 if args .target == "circom" :
125150 try :
126- circom_version = CircomSubprocess .get_installed_version ()
127- snarkjs_version = SnarkjsSubprocess .get_installed_version ()
128151 zk_regex_version = ZkRegexSubprocess .get_installed_version ()
152+ circom_version = CircomSubprocess .get_installed_version ()
129153 print ("-" * 80 )
130- print (f"Circom: { circom_version } " )
131- print (f"SnarkJS: { snarkjs_version } " )
132154 print (f"zk-regex: { zk_regex_version } " )
155+ print (f"Circom: { circom_version } " )
156+ if args .circom_prove :
157+ snarkjs_version = SnarkjsSubprocess .get_installed_version ()
158+ print (f"SnarkJS: { snarkjs_version } " )
159+
133160 except ValueError as e :
134161 print (e )
135162 exit (1 )
@@ -159,6 +186,20 @@ def do_fuzz(args):
159186 print (f"Path to ptau file { ptau_path } does not exist." )
160187 exit (1 )
161188
189+ elif args .target == "noir" :
190+ try :
191+ zk_regex_version = ZkRegexSubprocess .get_installed_version ()
192+ noir_version = NoirSubprocess .get_installed_version ()
193+ print ("-" * 80 )
194+ print (f"zk-regex: { zk_regex_version } " )
195+ print (f"Noir: { noir_version } " )
196+ if args .noir_prove :
197+ bb_version = BarretenbergSubprocess .get_installed_version ()
198+ print (f"Barretenberg: { bb_version } " )
199+ except ValueError as e :
200+ print (e )
201+ exit (1 )
202+
162203 print ("-" * 80 )
163204 print (f"Fuzzing with { args .fuzzer } fuzzer." )
164205 print ("=" * 80 )
@@ -173,9 +214,7 @@ def do_fuzz(args):
173214 kwargs = vars (args )
174215
175216 # set global seed
176- seed = str (uuid .uuid4 ())
177- kwargs ["seed" ] = seed
178- random .seed (seed )
217+ random .seed (args .seed )
179218
180219 if args .fuzzer == "grammar" :
181220 fuzz_with_grammar (
@@ -203,12 +242,6 @@ def do_reproduce(args):
203242
204243def main ():
205244 parser = argparse .ArgumentParser ()
206- parser .add_argument (
207- "--logger-level" ,
208- choices = ["DEBUG" , "INFO" , "WARNING" , "ERROR" , "CRITICAL" ],
209- default = "INFO" ,
210- help = "Set the logger level (default: INFO)." ,
211- )
212245
213246 subparser = parser .add_subparsers (dest = "subcommand" )
214247 subparser .add_parser (
0 commit comments