Skip to content

Commit 8f3930e

Browse files
committed
add perform_partition to uptime_snark_worker functions
1 parent 5de2885 commit 8f3930e

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

src/lib/uptime_service/uptime_snark_worker.ml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ module Worker = struct
1212
module T = struct
1313
module F = Rpc_parallel.Function
1414

15-
type 'w functions =
16-
{ perform_single :
17-
( 'w
18-
, Sok_message.t * Snark_work_lib.Spec.Single.Stable.Latest.t
19-
, (Ledger_proof.t * Time.Span.t) Or_error.t )
20-
F.t
21-
}
22-
2315
module Worker_state = struct
2416
(* required by rpc_parallel *)
2517
type init_arg = Logger.t * Genesis_constants.Constraint_constants.t
@@ -28,6 +20,19 @@ module Worker = struct
2820
include Impl.Worker_state
2921
end
3022

23+
type 'w functions =
24+
{ perform_single :
25+
( 'w
26+
, Sok_message.t * Snark_work_lib.Spec.Single.Stable.Latest.t
27+
, (Ledger_proof.t * Time.Span.t) Or_error.t )
28+
F.t
29+
; perform_partitioned :
30+
( 'w
31+
, Snark_work_lib.Spec.Partitioned.Stable.Latest.t
32+
, (Ledger_proof.t * Time.Span.t) Or_error.t )
33+
F.t
34+
}
35+
3136
module Connection_state = struct
3237
(* bin_io required by rpc_parallel *)
3338
type init_arg = unit [@@deriving bin_io_unversioned]
@@ -43,6 +48,12 @@ module Worker = struct
4348
let perform_single (state : Worker_state.t) (message, single_spec) =
4449
Impl.perform_single ~message state single_spec
4550

51+
let perform_partitioned (state : Worker_state.t) spec =
52+
let%map.Deferred.Or_error { Proof_carrying_data.proof; data } =
53+
Impl.perform_partitioned ~state ~spec
54+
in
55+
(proof, data)
56+
4657
let functions =
4758
let f (i, o, f) =
4859
C.create_rpc
@@ -57,6 +68,13 @@ module Worker = struct
5768
, [%bin_type_class:
5869
(Ledger_proof.Stable.Latest.t * Time.Span.t) Or_error.t]
5970
, perform_single )
71+
; perform_partitioned =
72+
f
73+
( [%bin_type_class:
74+
Snark_work_lib.Spec.Partitioned.Stable.Latest.t]
75+
, [%bin_type_class:
76+
(Ledger_proof.Stable.Latest.t * Time.Span.t) Or_error.t]
77+
, perform_partitioned )
6078
}
6179

6280
let init_worker_state (logger, constraint_constants) =
@@ -123,3 +141,6 @@ let create ~logger ~constraint_constants ~pids : t Deferred.t =
123141

124142
let perform_single { connection; _ } ((_message, _single_spec) as arg) =
125143
Worker.Connection.run connection ~f:Worker.functions.perform_single ~arg
144+
145+
let perform_partitioned { connection; _ } arg =
146+
Worker.Connection.run connection ~f:Worker.functions.perform_partitioned ~arg

0 commit comments

Comments
 (0)