@@ -239,9 +239,9 @@ def __init__(self, regex: str, kwargs: dict):
239239 self ._run_the_prover = kwargs .get ("circom_prove" , False )
240240 self ._ptau_path = kwargs .get ("circom_ptau" , None )
241241 self ._link_path = kwargs .get ("circom_library" , [])
242- self ._max_input_size = kwargs .get ("max_input_size " , 200 )
242+ self ._circom_max_input_size = kwargs .get ("circom_max_input_size " , 200 )
243243 self ._template_name = "TestRegex"
244- super ().__init__ (regex )
244+ super ().__init__ (regex , kwargs )
245245 self ._runner = "Circom"
246246
247247 def compile (self , regex : str ) -> None :
@@ -269,7 +269,7 @@ def compile(self, regex: str) -> None:
269269 # Append the circom file to include the main function
270270 with open (circom_file_path , 'a' ) as f :
271271 f .write ("\n \n " )
272- f .write ("component main {public [msg]} = " + f"{ self ._template_name } ({ self ._max_input_size } );" )
272+ f .write ("component main {public [msg]} = " + f"{ self ._template_name } ({ self ._circom_max_input_size } );" )
273273
274274 # Compile the circom code to wasm
275275 self ._wasm_path , self ._r1cs_path = CircomSubprocess .compile (circom_file_path , self ._link_path )
@@ -284,15 +284,15 @@ def match(self, input: str) -> bool:
284284 Match the regex on an input.
285285 """
286286 # Convert input to list of decimal ASCII values and pad input with zeroes
287- numeric_input = [ord (c ) for c in input ] + [0 ] * (self ._max_input_size - len (input ))
287+ numeric_input = [ord (c ) for c in input ] + [0 ] * (self ._circom_max_input_size - len (input ))
288288
289289 # Write input to a temporary JSON file
290290 with tempfile .NamedTemporaryFile (suffix = ".json" , delete = False ) as tmp_file :
291291 tmp_file .write (json .dumps ({"msg" : numeric_input }).encode ())
292292 input_path = tmp_file .name
293293
294294 # Skip if input is larger than circuit max input size
295- if len (numeric_input ) > self ._max_input_size :
295+ if len (numeric_input ) > self ._circom_max_input_size :
296296 logger .info (f"Input too large for input: { input } " )
297297 raise RegexRunError (f"Input too large for input: { input } " )
298298
0 commit comments