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

Remove R1CS_constraint_system from snark_intf #674

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions src/base/backend_intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ module type Constraint_system_intf = sig

val set_auxiliary_input_size : t -> int -> unit

val get_public_input_size : t -> int Core_kernel.Set_once.t

val get_rows_len : t -> int
end

Expand Down
5 changes: 5 additions & 0 deletions src/base/snark0.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ module Make_basic
and type r1cs := Backend.R1CS_constraint_system.t) =
struct
open Backend

type constraint_system = Backend.R1CS_constraint_system.t

module Checked_S = Checked_intf.Unextend (Checked)
include Runners.Make (Backend) (Checked) (As_prover) (Runner)
module Bigint = Bigint
Expand Down Expand Up @@ -1058,6 +1061,8 @@ module Run = struct
open Run_state
open Snark

type constraint_system = Backend.R1CS_constraint_system.t

let set_constraint_logger = set_constraint_logger

let clear_constraint_logger = clear_constraint_logger
Expand Down
4 changes: 2 additions & 2 deletions src/base/snark0.mli
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ module Make (Backend : Backend_intf.S) :
Snark_intf.S
with type field = Backend.Field.t
and type Bigint.t = Backend.Bigint.t
and type R1CS_constraint_system.t = Backend.R1CS_constraint_system.t
and type constraint_system = Backend.R1CS_constraint_system.t
and type Field.Vector.t = Backend.Field.Vector.t

module Run : sig
module Make (Backend : Backend_intf.S) :
Snark_intf.Run
with type field = Backend.Field.t
and type Bigint.t = Backend.Bigint.t
and type R1CS_constraint_system.t = Backend.R1CS_constraint_system.t
and type constraint_system = Backend.R1CS_constraint_system.t
and type Field.Constant.Vector.t = Backend.Field.Vector.t
end

Expand Down
25 changes: 5 additions & 20 deletions src/base/snark_intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -553,13 +553,7 @@ module type Basic = sig
(** The finite field over which the R1CS operates. *)
type field

(** The rank-1 constraint system used by this instance. See
{!module:Backend_intf.S.R1CS_constraint_system}. *)
module R1CS_constraint_system : sig
type t

val digest : t -> Md5.t
end
type constraint_system

module Bigint : sig
include Snarky_intf.Bigint_intf.Extended with type field := field
Expand Down Expand Up @@ -964,7 +958,7 @@ let multiply3 (x : Field.Var.t) (y : Field.Var.t) (z : Field.Var.t)
input_typ:('input_var, 'input_value) Typ.t
-> return_typ:('a, _) Typ.t
-> ('input_var -> 'a Checked.t)
-> R1CS_constraint_system.t
-> constraint_system

(** Internal: supplies arguments to a checked computation by storing them
according to the {!type:Data_spec.t} and passing the R1CS versions.
Expand Down Expand Up @@ -1100,17 +1094,7 @@ end

(** The imperative interface to Snarky. *)
module type Run_basic = sig
(** The rank-1 constraint system used by this instance. See
{!module:Backend_intf.S.R1CS_constraint_system}. *)
module R1CS_constraint_system : sig
type t

val digest : t -> Md5.t

val get_public_input_size : t -> int Core_kernel.Set_once.t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arguably snarky should also be able to return the public input size right? I guess we never have a snarky type that stores the circuit and the constraint system, but I think it'd be a good idea to have these at some point

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh okay, it's removed because it's actually unused. I see that this is not a very useful feature in general

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh and there's still get_primary_input_size, we should be rename primary -> public


val get_rows_len : t -> int
end
type constraint_system

(** The finite field over which the R1CS operates. *)
type field
Expand Down Expand Up @@ -1254,6 +1238,7 @@ module type Run_basic = sig
and Internal_Basic :
(Basic
with type field = field
and type constraint_system = constraint_system
and type 'a As_prover.Ref.t = 'a As_prover.Ref.t)

module Bitstring_checked : sig
Expand Down Expand Up @@ -1361,7 +1346,7 @@ module type Run_basic = sig
input_typ:('input_var, 'input_value) Typ.t
-> return_typ:('a, _) Typ.t
-> ('input_var -> unit -> 'a)
-> R1CS_constraint_system.t
-> constraint_system

val generate_witness :
input_typ:('input_var, 'input_value) Typ.t
Expand Down