Skip to content

Commit

Permalink
feat(snarky_bindings): add rot function to Gates module
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMinkov committed Oct 12, 2023
1 parent a6b9460 commit 7c4ee93
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
30 changes: 30 additions & 0 deletions ocaml/lib/snarky_bindings.ml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,34 @@ module Gates = struct
compact
} )
} )

let rot word rotated excess bound_limb0 bound_limb1 bound_limb2 bound_limb3
bound_crumb0 bound_crumb1 bound_crumb2 bound_crumb3 bound_crumb4
two_to_rot bound_crumb5 bound_crumb6 bound_crumb7 =
Impl.with_label "rot64_gate" (fun () ->
Impl.assert_
{ annotation = Some __LOC__
; basic =
Kimchi_backend_common.Plonk_constraint_system.Plonk_constraint.T
(Rot64
{ (* Current row *) word
; rotated
; excess
; bound_limb0
; bound_limb1
; bound_limb2
; bound_limb3
; bound_crumb0
; bound_crumb1
; bound_crumb2
; bound_crumb3
; bound_crumb4
; bound_crumb5
; bound_crumb6
; bound_crumb7 (* Coefficients *)
; two_to_rot (* Rotation scalar 2^rot *)
} )
} )
end

module Bool = struct
Expand Down Expand Up @@ -317,6 +345,8 @@ let snarky =
val gates =
object%js
method rangeCheck0 = Gates.range_check0

method rot = Gates.rot
end

val bool =
Expand Down
19 changes: 19 additions & 0 deletions ocaml/lib/snarky_bindings.mli
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@ val snarky :
* Field.t
-> Impl.field
-> unit )
Js.meth
; rot :
( Field.t
-> Field.t
-> Field.t
-> Field.t
-> Field.t
-> Field.t
-> Field.t
-> Field.t
-> Field.t
-> Field.t
-> Field.t
-> Field.t
-> Impl.field
-> Field.t
-> Field.t
-> Field.t
-> unit )
Js.meth >
Js.t
Js.readonly_prop
Expand Down

0 comments on commit 7c4ee93

Please sign in to comment.