From 5e3beb37a61e2c6199f303d461bf1c5d04bbd921 Mon Sep 17 00:00:00 2001 From: Mikhail Volkhov Date: Mon, 15 Jan 2024 15:34:25 +0000 Subject: [PATCH 1/2] Cosmetics --- src/base/snark0.ml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/base/snark0.ml b/src/base/snark0.ml index 8b0c27e08..f6b41c2ac 100644 --- a/src/base/snark0.ml +++ b/src/base/snark0.ml @@ -645,7 +645,7 @@ struct end end -(** The main functor for the monadic interface. +(** The main functor for the monadic interface. See [Run.Make] for the same thing but for the imperative interface. *) module Make (Backend : Backend_intf.S) = struct module Backend_extended = Backend_extended.Make (Backend) @@ -1263,8 +1263,8 @@ module Run = struct let inject_wrapper ~f x = f x in inject_wrapper ~f (x a) - (** Caches the global [state] before running [f]. - It is expected that [f] will reset the global state for its own use only, + (** Caches the global [state] before running [f]. + It is expected that [f] will reset the global state for its own use only, hence why we need to reset it after running [f].*) let finalize_is_running f = let cached_state = !state in @@ -1292,16 +1292,17 @@ module Run = struct let generate_witness ~input_typ ~return_typ x a : Proof_inputs.t = finalize_is_running (fun () -> - let x = inject_wrapper x ~f:(fun x () -> mark_active ~f:x) in - Perform.generate_witness ~run:as_stateful ~input_typ ~return_typ x a ) + let x_wrapped = inject_wrapper x ~f:(fun x () -> mark_active ~f:x) in + Perform.generate_witness ~run:as_stateful ~input_typ ~return_typ + x_wrapped a ) let generate_witness_conv (type out) ~(f : Proof_inputs.t -> 'r_value -> out) ~input_typ ~return_typ x input : out = finalize_is_running (fun () -> - let x = inject_wrapper x ~f:(fun x () -> mark_active ~f:x) in + let x_wrapped = inject_wrapper x ~f:(fun x () -> mark_active ~f:x) in Perform.generate_witness_conv ~run:as_stateful ~f ~input_typ - ~return_typ x input ) + ~return_typ x_wrapped input ) let run_unchecked x = finalize_is_running (fun () -> From c7765872b7c3a08a6d5cbcf07579fa2791a0ebec Mon Sep 17 00:00:00 2001 From: Mikhail Volkhov Date: Wed, 17 Jan 2024 14:08:20 +0000 Subject: [PATCH 2/2] Empty commit to trigger CI