Skip to content

Commit

Permalink
add verification key of yojson
Browse files Browse the repository at this point in the history
  • Loading branch information
mitschabaude committed Oct 20, 2023
1 parent 2f5070f commit d4e042f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lib/pickles/pickles_intf.mli
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module type S = sig
[%%versioned:
module Stable : sig
module V2 : sig
type t [@@deriving to_yojson]
type t [@@deriving to_yojson, of_yojson]
end
end]

Expand Down
14 changes: 12 additions & 2 deletions src/lib/pickles/verification_key.ml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ module Verifier_index_json = struct
verifier_index_to_yojson fp
(fun _ -> `Null)
(polycomm_to_yojson (or_infinity_to_yojson fq))

let of_yojson fp fq =
verifier_index_of_yojson fp
(fun _ -> Ok (Backend.Tock.Keypair.load_urs ()))
(polycomm_of_yojson (or_infinity_of_yojson fq))
end

module Data = struct
Expand Down Expand Up @@ -139,10 +144,13 @@ module Stable = struct
(Impls.Wrap.Verification_key.t
[@to_yojson
Verifier_index_json.to_yojson Backend.Tock.Field.to_yojson
Backend.Tick.Field.to_yojson] )
Backend.Tick.Field.to_yojson]
[@of_yojson
Verifier_index_json.of_yojson Backend.Tock.Field.of_yojson
Backend.Tick.Field.of_yojson] )
; data : Data.t
}
[@@deriving fields, to_yojson]
[@@deriving fields, to_yojson, of_yojson]

let to_latest = Fn.id

Expand Down Expand Up @@ -208,6 +216,8 @@ end]

let to_yojson = Stable.Latest.to_yojson

let of_yojson = Stable.Latest.of_yojson

let dummy_commitments g =
let open Plonk_types in
{ Plonk_verification_key_evals.sigma_comm =
Expand Down
4 changes: 2 additions & 2 deletions src/lib/pickles/verification_key.mli
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module Stable : sig
; index : Impls.Wrap.Verification_key.t
; data : Data.t
}
[@@deriving fields, to_yojson, bin_shape, bin_io]
[@@deriving fields, to_yojson, of_yojson, bin_shape, bin_io]

include Pickles_types.Sigs.VERSIONED
end
Expand All @@ -33,7 +33,7 @@ type t = Stable.Latest.t =
; index : Impls.Wrap.Verification_key.t
; data : Data.t
}
[@@deriving fields, to_yojson]
[@@deriving fields, to_yojson, of_yojson]

val dummy_commitments : 'a -> 'a Pickles_types.Plonk_verification_key_evals.t

Expand Down

0 comments on commit d4e042f

Please sign in to comment.