Skip to content

Commit

Permalink
Cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
volhovm committed Jan 15, 2024
1 parent 94b2df8 commit 5e3beb3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/base/snark0.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 () ->
Expand Down

0 comments on commit 5e3beb3

Please sign in to comment.