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

Snarkyjs: Reduce loading time #829

Merged
merged 7 commits into from
Aug 22, 2023
Merged
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
4 changes: 0 additions & 4 deletions src/base/backend_extended.ml
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,6 @@ struct

let t_of_sexp = Fn.compose of_bignum_bigint Bignum_bigint.t_of_sexp

let to_string = Fn.compose Bignum_bigint.to_string to_bignum_bigint

let of_string = Fn.compose of_bignum_bigint Bignum_bigint.of_string

let%test_unit "project correctness" =
Quickcheck.test
Quickcheck.Generator.(
Expand Down
13 changes: 7 additions & 6 deletions src/base/snark0.ml
Original file line number Diff line number Diff line change
Expand Up @@ -464,11 +464,12 @@ struct
(of_binary (lt_binary (xs :> Boolean.var list) (ys :> bool list)))

let field_size_bits =
List.init Field.size_in_bits ~f:(fun i ->
Z.testbit
(Bignum_bigint.to_zarith_bigint Field.size)
Stdlib.(Field.size_in_bits - 1 - i) )
|> Bitstring_lib.Bitstring.Msb_first.of_list
lazy
( List.init Field.size_in_bits ~f:(fun i ->
Z.testbit
(Bignum_bigint.to_zarith_bigint Field.size)
Stdlib.(Field.size_in_bits - 1 - i) )
|> Bitstring_lib.Bitstring.Msb_first.of_list )

let unpack_full x =
let module Bitstring = Bitstring_lib.Bitstring in
Expand All @@ -480,7 +481,7 @@ struct
let%map () =
lt_bitstring_value
(Bitstring.Msb_first.of_lsb_first res)
field_size_bits
(Lazy.force field_size_bits)
>>= Checked.Boolean.Assert.is_true
in
res
Expand Down
4 changes: 4 additions & 0 deletions src/intf/field.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ module type S = sig

val of_int : int -> t

val of_string : string -> t

val to_string : t -> string

val one : t

val zero : t
Expand Down
Loading