Skip to content

Commit

Permalink
Remove return_early_digest_exception param and related exception
Browse files Browse the repository at this point in the history
Fix #14409
  • Loading branch information
dannywillems committed Oct 23, 2023
1 parent f16e20a commit 35f90e7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 34 deletions.
24 changes: 5 additions & 19 deletions src/lib/pickles/compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ open Poly_types
open Hlist
open Backend

exception Return_digest of Md5.t

let profile_constraints = false

let verify_promise = Verify.verify
Expand Down Expand Up @@ -347,7 +345,6 @@ struct
-> ?disk_keys:
(Cache.Step.Key.Verification.t, branches) Vector.t
* Cache.Wrap.Key.Verification.t
-> ?return_early_digest_exception:bool
-> ?override_wrap_domain:Pickles_base.Proofs_verified.t
-> ?override_wrap_main:
(max_proofs_verified, branches, prev_varss) wrap_main_generic
Expand Down Expand Up @@ -382,8 +379,7 @@ struct
* _
* _
* _ =
fun ~self ~cache ~proof_cache ?disk_keys
?(return_early_digest_exception = false) ?override_wrap_domain
fun ~self ~cache ~proof_cache ?disk_keys ?override_wrap_domain
?override_wrap_main ?(num_chunks = 1) ~branches:(module Branches)
~max_proofs_verified ~name ~constraint_constants ~public_input
~auxiliary_typ ~choices () ->
Expand Down Expand Up @@ -555,13 +551,6 @@ struct
in
let () = if true then log_step main typ name b.index in
let open Impls.Step in
(* HACK: TODO docs *)
if return_early_digest_exception then
raise
(Return_digest
( constraint_system ~input_typ:Typ.unit ~return_typ:typ main
|> R1CS_constraint_system.digest ) ) ;

let k_p =
lazy
(let cs =
Expand Down Expand Up @@ -957,7 +946,6 @@ let compile_with_wrap_main_override_promise :
-> ?disk_keys:
(Cache.Step.Key.Verification.t, branches) Vector.t
* Cache.Wrap.Key.Verification.t
-> ?return_early_digest_exception:bool
-> ?override_wrap_domain:Pickles_base.Proofs_verified.t
-> ?override_wrap_main:
(max_proofs_verified, branches, prev_varss) wrap_main_generic
Expand Down Expand Up @@ -1007,8 +995,7 @@ let compile_with_wrap_main_override_promise :
(* This function is an adapter between the user-facing Pickles.compile API
and the underlying Make(_).compile function which builds the circuits.
*)
fun ?self ?(cache = []) ?proof_cache ?disk_keys
?(return_early_digest_exception = false) ?override_wrap_domain
fun ?self ?(cache = []) ?proof_cache ?disk_keys ?override_wrap_domain
?override_wrap_main ?num_chunks ~public_input ~auxiliary_typ ~branches
~max_proofs_verified ~name ~constraint_constants ~choices () ->
let self =
Expand Down Expand Up @@ -1076,10 +1063,9 @@ let compile_with_wrap_main_override_promise :
r :: conv_irs rs
in
let provers, wrap_vk, wrap_disk_key, cache_handle =
M.compile ~return_early_digest_exception ~self ~proof_cache ~cache
?disk_keys ?override_wrap_domain ?override_wrap_main ?num_chunks ~branches
~max_proofs_verified ~name ~public_input ~auxiliary_typ
~constraint_constants
M.compile ~self ~proof_cache ~cache ?disk_keys ?override_wrap_domain
?override_wrap_main ?num_chunks ~branches ~max_proofs_verified ~name
~public_input ~auxiliary_typ ~constraint_constants
~choices:(fun ~self -> conv_irs (choices ~self))
()
in
Expand Down
3 changes: 0 additions & 3 deletions src/lib/pickles/compile.mli
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ open Async_kernel
open Pickles_types
open Hlist

exception Return_digest of Md5.t

val pad_messages_for_next_wrap_proof :
(module Pickles_types.Hlist.Maxes.S
with type length = 'max_proofs_verified
Expand Down Expand Up @@ -278,7 +276,6 @@ val compile_with_wrap_main_override_promise :
-> ?disk_keys:
(Cache.Step.Key.Verification.t, 'branches) Vector.t
* Cache.Wrap.Key.Verification.t
-> ?return_early_digest_exception:bool
-> ?override_wrap_domain:Pickles_base.Proofs_verified.t
-> ?override_wrap_main:
('max_proofs_verified, 'branches, 'prev_varss) wrap_main_generic
Expand Down
14 changes: 5 additions & 9 deletions src/lib/pickles/pickles.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ module Make_str (_ : Wire_types.Concrete) = struct
module Step_verifier = Step_verifier
module Proof_cache = Proof_cache

exception Return_digest = Compile.Return_digest

type chunking_data = Verify.Instance.chunking_data =
{ num_chunks : int; domain_size : int; zk_rows : int }

Expand Down Expand Up @@ -311,14 +309,12 @@ module Make_str (_ : Wire_types.Concrete) = struct
let compile_with_wrap_main_override_promise =
Compile.compile_with_wrap_main_override_promise

let compile_promise ?self ?cache ?proof_cache ?disk_keys
?return_early_digest_exception ?override_wrap_domain ?num_chunks
~public_input ~auxiliary_typ ~branches ~max_proofs_verified ~name
~constraint_constants ~choices () =
let compile_promise ?self ?cache ?proof_cache ?disk_keys ?override_wrap_domain
?num_chunks ~public_input ~auxiliary_typ ~branches ~max_proofs_verified
~name ~constraint_constants ~choices () =
compile_with_wrap_main_override_promise ?self ?cache ?proof_cache ?disk_keys
?return_early_digest_exception ?override_wrap_domain ?num_chunks
~public_input ~auxiliary_typ ~branches ~max_proofs_verified ~name
~constraint_constants ~choices ()
?override_wrap_domain ?num_chunks ~public_input ~auxiliary_typ ~branches
~max_proofs_verified ~name ~constraint_constants ~choices ()

let compile ?self ?cache ?proof_cache ?disk_keys ?override_wrap_domain
?num_chunks ~public_input ~auxiliary_typ ~branches ~max_proofs_verified
Expand Down
3 changes: 0 additions & 3 deletions src/lib/pickles/pickles_intf.mli
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ module type S = sig
module Common = Common
module Proof_cache = Proof_cache

exception Return_digest of Md5.t

module type Statement_intf = sig
type field

Expand Down Expand Up @@ -374,7 +372,6 @@ module type S = sig
-> ?disk_keys:
(Cache.Step.Key.Verification.t, 'branches) Vector.t
* Cache.Wrap.Key.Verification.t
-> ?return_early_digest_exception:bool
-> ?override_wrap_domain:Pickles_base.Proofs_verified.t
-> ?num_chunks:int
-> public_input:
Expand Down

0 comments on commit 35f90e7

Please sign in to comment.