@@ -30,6 +30,7 @@ module HL = struct
3030end
3131
3232exception BDepError of string
33+ exception BDepUninitializedInputs
3334
3435
3536let int_of_form (hyps : hyps ) (f : form ) : BI.zint =
@@ -106,7 +107,9 @@ let mapreduce
106107 | {v_name} , Some (sz , offset ) ->
107108 circuit_slice (Option. get (pstate_get_opt pstate v_name)) sz offset
108109 )
109- outvs in
110+ outvs
111+ in
112+ if not (List. for_all (fun c -> not (circuit_has_uninitialized c)) circs) then raise BDepUninitializedInputs ;
110113
111114 (* This is required for now as we do not allow mapreduce with multiple arguments *)
112115 (* assert (Set.cardinal @@ Set.of_list @@ List.map (fun c -> c.inps) circs = 1); *)
@@ -197,7 +200,12 @@ let prog_equiv_prod
197200 (List. map (fun v -> v.v_name) outvs_l) in
198201 let circs_r = List. map (fun v -> pstate_get pstate_r v)
199202 (List. map (fun v -> v.v_name) outvs_r) in
200-
203+
204+ if not (
205+ (List. for_all (fun c -> not (circuit_has_uninitialized c)) circs_l) ||
206+ (List. for_all (fun c -> not (circuit_has_uninitialized c)) circs_r)
207+ ) then raise BDepUninitializedInputs ;
208+
201209 (* assert (Set.cardinal @@ Set.of_list @@ List.map (fun c -> c.inps) circs_l = 1); *)
202210 (* assert (Set.cardinal @@ Set.of_list @@ List.map (fun c -> c.inps) circs_r = 1);*)
203211 let c_l = try
@@ -326,6 +334,7 @@ let circ_form_eval_plus_equiv
326334 let f = EcPV.PVM. subst1 env (PVloc v.v_name) mem cur_val f in
327335 let pcond = match pstate_get_opt pstate v.v_name with
328336 | Some circ -> begin try
337+ if circuit_has_uninitialized circ then raise BDepUninitializedInputs ;
329338 Some (circuit_ueq circ (circuit_of_form hyps cur_val))
330339 with CircError err ->
331340 raise (BDepError (" Failed to generate circuit for current value precondition with error:\n " ^ err))
@@ -377,6 +386,8 @@ let mapreduce_eval
377386 begin
378387 let circs = List. map (fun v -> pstate_get pstate v) (List. map (fun v -> v.v_name) outvs) in
379388
389+ if not (List. for_all (fun c -> not (circuit_has_uninitialized c)) circs) then raise BDepUninitializedInputs ;
390+
380391 let c = try
381392 (circuit_aggregate circs)
382393 with CircError _err ->
0 commit comments