Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cosmetics/Refactoring #833

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/base/snark0.ml
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,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 @@ -1245,8 +1245,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 @@ -1321,16 +1321,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 generate_witness_manual ?handlers ~input_typ ~return_typ input =
let builder =
Expand Down
Loading