Skip to content

Commit ff0f1a9

Browse files
committed
Merge branch 'corvo/define-partitioned-work' into corvo/refactor-snark-worker-2
2 parents 8481cad + 3b2d3f5 commit ff0f1a9

File tree

1 file changed

+32
-46
lines changed

1 file changed

+32
-46
lines changed

src/lib/snark_work_lib/partitioned.ml

Lines changed: 32 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,9 @@ module Proof_with_metric = struct
458458
end
459459

460460
let construct_selector_result
461-
~(instances : (Selector.Single.Spec.t * Proof_with_metric.t) One_or_two.t)
462-
~fee ~prover =
461+
~(instances :
462+
(_ Work.Single.Spec.t * _ Proof_with_metric.Poly.t) One_or_two.t ) ~fee
463+
~prover =
463464
let proofs = One_or_two.map ~f:(fun (_, { proof; _ }) -> proof) instances in
464465
let metrics =
465466
One_or_two.map
@@ -476,7 +477,8 @@ let construct_selector_result
476477
in
477478

478479
let instances = One_or_two.map ~f:(fun (single, _) -> single) instances in
479-
({ proofs; metrics; spec = { instances; fee }; prover } : Selector.Result.t)
480+
( { proofs; metrics; spec = ({ instances; fee } : _ Work.Spec.t); prover }
481+
: _ Work.Result.t )
480482

481483
module Result = struct
482484
module Poly = struct
@@ -553,53 +555,37 @@ module Result = struct
553555

554556
module V1 = struct
555557
type t =
556-
{ data :
557-
( Transaction_witness.Stable.V2.t
558-
, Transaction_snark.Zkapp_command_segment.Witness.Stable.V1.t
559-
, Ledger_proof.Stable.V2.t
560-
, Proof_with_metric.Stable.V1.t )
561-
Spec.Poly.Stable.V1.t
562-
; prover : Signature_lib.Public_key.Compressed.Stable.V1.t
563-
}
558+
( Transaction_witness.Stable.V2.t
559+
, Transaction_snark.Zkapp_command_segment.Witness.Stable.V1.t
560+
, Ledger_proof.Stable.V2.t
561+
, Proof_with_metric.Stable.V1.t )
562+
Spec.Poly.Stable.V1.t
564563

565564
let to_latest = Fn.id
566565
end
567566
end]
568567

569568
type t =
570-
{ data :
571-
( Transaction_witness.t
572-
, Transaction_snark.Zkapp_command_segment.Witness.t
573-
, Ledger_proof.Cached.t
574-
, Proof_with_metric.t )
575-
Spec.Poly.t
576-
; prover : Signature_lib.Public_key.Compressed.t
577-
}
578-
579-
let read_all_proofs_from_disk ({ data; prover } : t) : Stable.Latest.t =
580-
let data =
581-
Spec.Poly.map ~f_witness:Transaction_witness.read_all_proofs_from_disk
582-
~f_zkapp_command_segment_witness:
583-
Transaction_witness.Zkapp_command_segment_witness
584-
.read_all_proofs_from_disk
585-
~f_proof:Ledger_proof.Cached.read_proof_from_disk
586-
~f_metric:Proof_with_metric.read_all_proofs_from_disk data
587-
in
588-
589-
{ data; prover }
590-
591-
let write_all_proofs_to_disk ~proof_cache_db
592-
({ data; prover } : Stable.Latest.t) : t =
593-
let data =
594-
Spec.Poly.map
595-
~f_witness:
596-
(Transaction_witness.write_all_proofs_to_disk ~proof_cache_db)
597-
~f_zkapp_command_segment_witness:
598-
(Transaction_witness.Zkapp_command_segment_witness
599-
.write_all_proofs_to_disk ~proof_cache_db )
600-
~f_proof:(Ledger_proof.Cached.write_proof_to_disk ~proof_cache_db)
601-
~f_metric:(Proof_with_metric.write_all_proofs_to_disk ~proof_cache_db)
602-
data
603-
in
604-
{ data; prover }
569+
( Transaction_witness.t
570+
, Transaction_snark.Zkapp_command_segment.Witness.t
571+
, Ledger_proof.Cached.t
572+
, Proof_with_metric.t )
573+
Spec.Poly.t
574+
575+
let read_all_proofs_from_disk =
576+
Spec.Poly.map ~f_witness:Transaction_witness.read_all_proofs_from_disk
577+
~f_zkapp_command_segment_witness:
578+
Transaction_witness.Zkapp_command_segment_witness
579+
.read_all_proofs_from_disk
580+
~f_proof:Ledger_proof.Cached.read_proof_from_disk
581+
~f_metric:Proof_with_metric.read_all_proofs_from_disk
582+
583+
let write_all_proofs_to_disk ~proof_cache_db =
584+
Spec.Poly.map
585+
~f_witness:(Transaction_witness.write_all_proofs_to_disk ~proof_cache_db)
586+
~f_zkapp_command_segment_witness:
587+
(Transaction_witness.Zkapp_command_segment_witness
588+
.write_all_proofs_to_disk ~proof_cache_db )
589+
~f_proof:(Ledger_proof.Cached.write_proof_to_disk ~proof_cache_db)
590+
~f_metric:(Proof_with_metric.write_all_proofs_to_disk ~proof_cache_db)
605591
end

0 commit comments

Comments
 (0)