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

normalizing snarky yojson serializers to match kimchi common #15723

Merged
merged 8 commits into from
Aug 23, 2024
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
1 change: 0 additions & 1 deletion src/lib/crypto/kimchi_backend/common/dune
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
base.base_internalhash_types
;; local libraries
tuple_lib
snarky.backendless
key_cache
pickles_types
hex
Expand Down
1 change: 0 additions & 1 deletion src/lib/crypto/kimchi_backend/dune
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
kimchi_types
pasta_bindings
snarkette
snarky.backendless
key_cache
hex
kimchi_backend_common
Expand Down
14 changes: 1 addition & 13 deletions src/lib/mina_base/account_update.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,7 @@ module Authorization_kind = struct
type t =
Mina_wire_types.Mina_base.Account_update.Authorization_kind.V1.t =
| Signature
| Proof of
(Field.t
[@version_asserted]
[@to_yojson fun t -> `String (Snark_params.Tick.Field.to_string t)]
[@of_yojson
function
| `String s ->
let field = Snark_params.Tick.Field.of_string s in
let s' = Snark_params.Tick.Field.to_string field in
if String.equal s s' then Ok field
else Error "Invalid JSON for field"
| _ ->
Error "expected JSON string"] )
| Proof of (Field.t[@version_asserted])
| None_given
[@@deriving sexp, equal, yojson, hash, compare]

Expand Down
2 changes: 1 addition & 1 deletion src/lib/mina_wire_types/snark_params.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Tick = struct
module Field = struct
type t = Pasta_bindings.Fp.t
type t = Kimchi_pasta_basic.Fp.t
end

module Inner_curve = struct
Expand Down
4 changes: 4 additions & 0 deletions src/lib/snark_params/snark_params.ml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ module Tick = struct
include Tick0.Field
module Bits = Bits.Make_field (Tick0.Field) (Tick0.Bigint)

let to_yojson = Kimchi_pasta_basic.Fp.to_yojson

let of_yojson = Kimchi_pasta_basic.Fp.of_yojson

let size_in_triples = Int.((size_in_bits + 2) / 3)
end

Expand Down