Skip to content

Commit eca706b

Browse files
authoredJan 30, 2025
Merge pull request #16488 from MinaProtocol/georgeee/proof-cache-tag-11-remove-sexp-from-snark-pool
Remove sexp derivation from Snark_pool
2 parents a370796 + 5a2f73e commit eca706b

File tree

4 files changed

+24
-45
lines changed

4 files changed

+24
-45
lines changed
 

‎src/lib/network_pool/intf.ml

+10-10
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ open Network_peer
1010
* can only be initialized, and any interaction with it must go through
1111
* its [Resource_pool_diff_intf] *)
1212
module type Resource_pool_base_intf = sig
13-
type t [@@deriving sexp_of]
13+
type t
1414

1515
val label : string
1616

@@ -19,7 +19,7 @@ module type Resource_pool_base_intf = sig
1919
type transition_frontier
2020

2121
module Config : sig
22-
type t [@@deriving sexp_of]
22+
type t
2323
end
2424

2525
(** Diff from a transition frontier extension that would update the resource pool*)
@@ -74,12 +74,12 @@ module type Resource_pool_diff_intf = sig
7474

7575
val label : string
7676

77-
type t [@@deriving sexp, to_yojson]
77+
type t [@@deriving to_yojson]
7878

79-
type verified [@@deriving sexp, to_yojson]
79+
type verified [@@deriving to_yojson]
8080

8181
(** Part of the diff that was not added to the resource pool*)
82-
type rejected [@@deriving sexp, to_yojson]
82+
type rejected [@@deriving to_yojson]
8383

8484
val empty : t
8585

@@ -302,9 +302,9 @@ module type Snark_pool_diff_intf = sig
302302
Transaction_snark_work.Statement.t
303303
* Ledger_proof.t One_or_two.t Priced_proof.t
304304
| Empty
305-
[@@deriving compare, sexp]
305+
[@@deriving compare]
306306

307-
type verified = t [@@deriving compare, sexp]
307+
type verified = t [@@deriving compare]
308308

309309
type compact =
310310
{ work_ids : int One_or_two.t
@@ -337,7 +337,7 @@ end
337337
module type Transaction_pool_diff_intf = sig
338338
type resource_pool
339339

340-
type t = User_command.t list [@@deriving sexp, of_yojson]
340+
type t = User_command.t list [@@deriving of_yojson]
341341

342342
module Diff_error : sig
343343
type t =
@@ -353,13 +353,13 @@ module type Transaction_pool_diff_intf = sig
353353
| Fee_payer_account_not_found
354354
| Fee_payer_not_permitted_to_send
355355
| After_slot_tx_end
356-
[@@deriving sexp, yojson]
356+
[@@deriving yojson]
357357

358358
val to_string_hum : t -> string
359359
end
360360

361361
module Rejected : sig
362-
type t = (User_command.t * Diff_error.t) list [@@deriving sexp, yojson]
362+
type t = (User_command.t * Diff_error.t) list [@@deriving yojson]
363363
end
364364

365365
type Structured_log_events.t +=

‎src/lib/network_pool/snark_pool.ml

+8-29
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct
9898
; verifier : (Verifier.t[@sexp.opaque])
9999
; disk_location : string
100100
}
101-
[@@deriving sexp, make]
101+
[@@deriving make]
102102
end
103103

104104
type transition_frontier_diff =
@@ -113,7 +113,6 @@ struct
113113
; account_creation_fee : Currency.Fee.t
114114
; batcher : Batcher.Snark_pool.t
115115
}
116-
[@@deriving sexp]
117116

118117
let make_config = Config.make
119118

@@ -546,7 +545,7 @@ module Diff_versioned = struct
546545
* Ledger_proof.Stable.V2.t One_or_two.Stable.V1.t
547546
Priced_proof.Stable.V1.t
548547
| Empty
549-
[@@deriving compare, sexp, to_yojson, hash]
548+
[@@deriving compare, to_yojson, hash]
550549

551550
let to_latest = Fn.id
552551
end
@@ -557,7 +556,7 @@ module Diff_versioned = struct
557556
Transaction_snark_work.Statement.t
558557
* Ledger_proof.t One_or_two.t Priced_proof.t
559558
| Empty
560-
[@@deriving compare, sexp, to_yojson, hash]
559+
[@@deriving compare, to_yojson, hash]
561560
end
562561

563562
let%test_module "random set test" =
@@ -688,15 +687,6 @@ let%test_module "random set test" =
688687
@@ Signature_lib.Public_key.Compressed.equal mal_pk fee.prover ) )
689688
in
690689
Quickcheck.test ~trials:5
691-
~sexp_of:
692-
[%sexp_of:
693-
(Mock_snark_pool.Resource_pool.t * Mocks.Transition_frontier.t)
694-
Deferred.t
695-
* ( Transaction_snark_work.Statement.t
696-
* Ledger_proof.t One_or_two.t
697-
* Fee_with_prover.t
698-
* Signature_lib.Public_key.Compressed.t )
699-
list]
700690
(Quickcheck.Generator.tuple2 (gen ()) invalid_work_gen)
701691
~f:(fun (t, invalid_work_lst) ->
702692
Async.Thread_safe.block_on_async_exn (fun () ->
@@ -731,13 +721,6 @@ let%test_module "random set test" =
731721
the snark pool, the fee of the work is at most the minimum \
732722
of those fees" =
733723
Quickcheck.test ~trials:5
734-
~sexp_of:
735-
[%sexp_of:
736-
(Mock_snark_pool.Resource_pool.t * Mocks.Transition_frontier.t)
737-
Deferred.t
738-
* Mocks.Transaction_snark_work.Statement.t
739-
* Fee_with_prover.t
740-
* Fee_with_prover.t]
741724
(Async.Quickcheck.Generator.tuple4 (gen ())
742725
Mocks.Transaction_snark_work.Statement.gen Fee_with_prover.gen
743726
Fee_with_prover.gen )
@@ -761,13 +744,6 @@ let%test_module "random set test" =
761744
proof of the same work only if it's fee is smaller than the \
762745
existing priced proof" =
763746
Quickcheck.test ~trials:5
764-
~sexp_of:
765-
[%sexp_of:
766-
(Mock_snark_pool.Resource_pool.t * Mocks.Transition_frontier.t)
767-
Deferred.t
768-
* Mocks.Transaction_snark_work.Statement.t
769-
* Fee_with_prover.t
770-
* Fee_with_prover.t]
771747
(Quickcheck.Generator.tuple4 (gen ())
772748
Mocks.Transaction_snark_work.Statement.gen Fee_with_prover.gen
773749
Fee_with_prover.gen )
@@ -955,8 +931,11 @@ let%test_module "random set test" =
955931
in
956932
let check_work ~expected ~got =
957933
let sort = List.sort ~compare:compare_work in
958-
[%test_eq: Mock_snark_pool.Resource_pool.Diff.t list] (sort got)
959-
(sort expected)
934+
if
935+
[%compare: Mock_snark_pool.Resource_pool.Diff.t list] (sort got)
936+
(sort expected)
937+
<> 0
938+
then failwith "diffs don't match"
960939
in
961940
Async.Thread_safe.block_on_async_exn (fun () ->
962941
let open Deferred.Let_syntax in

‎src/lib/network_pool/snark_pool.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ module Diff_versioned : sig
8787
* Ledger_proof.Stable.V2.t One_or_two.Stable.V1.t
8888
Priced_proof.Stable.V1.t
8989
| Empty
90-
[@@deriving compare, sexp, hash]
90+
[@@deriving compare, hash]
9191
end
9292
end]
9393
end

‎src/lib/network_pool/snark_pool_diff.ml

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ module Rejected = struct
1111
[@@@no_toplevel_latest_type]
1212

1313
module V1 = struct
14-
type t = unit [@@deriving sexp, yojson]
14+
type t = unit [@@deriving to_yojson]
1515

1616
let to_latest = Fn.id
1717
end
1818
end]
1919

20-
type t = Stable.Latest.t [@@deriving sexp, yojson]
20+
type t = Stable.Latest.t [@@deriving to_yojson]
2121
end
2222

2323
module Make
@@ -28,13 +28,13 @@ module Make
2828
type t = Mina_wire_types.Network_pool.Snark_pool.Diff_versioned.V2.t =
2929
| Add_solved_work of Work.t * Ledger_proof.t One_or_two.t Priced_proof.t
3030
| Empty
31-
[@@deriving compare, sexp, to_yojson, hash]
31+
[@@deriving compare, to_yojson, hash]
3232

33-
type verified = t [@@deriving compare, sexp, to_yojson]
33+
type verified = t [@@deriving compare, to_yojson, hash]
3434

3535
let t_of_verified = ident
3636

37-
type rejected = Rejected.t [@@deriving sexp, yojson]
37+
type rejected = Rejected.t [@@deriving to_yojson]
3838

3939
let label = Pool.label
4040

0 commit comments

Comments
 (0)