• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MinaProtocol / mina / 3409

26 Feb 2025 01:10PM UTC coverage: 32.353% (-28.4%) from 60.756%
3409

push

buildkite

web-flow
Merge pull request #16687 from MinaProtocol/dw/merge-compatible-into-develop-20250225

Merge compatible into develop [20250224]

23144 of 71535 relevant lines covered (32.35%)

16324.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

17.78
/src/lib/snark_work_lib/work.ml
1
(* TODO: remove type generalizations #2594 *)
2

16✔
3
open Core_kernel
4

5
module Single = struct
6
  module Spec = struct
7
    [%%versioned
8
    module Stable = struct
9
      [@@@no_toplevel_latest_type]
10

11
      module V2 = struct
12
        type ('witness, 'ledger_proof) t =
16✔
13
          | Transition of Transaction_snark.Statement.Stable.V2.t * 'witness
×
14
          | Merge of
×
15
              Transaction_snark.Statement.Stable.V2.t
×
16
              * 'ledger_proof
×
17
              * 'ledger_proof
×
18
        [@@deriving sexp, to_yojson]
48✔
19
      end
20
    end]
21

22
    type ('witness, 'ledger_proof) t =
×
23
          ('witness, 'ledger_proof) Stable.Latest.t =
24
      | Transition of Transaction_snark.Statement.t * 'witness
×
25
      | Merge of Transaction_snark.Statement.t * 'ledger_proof * 'ledger_proof
×
26
    [@@deriving sexp, yojson]
27

28
    let map ~f_witness ~f_proof = function
29
      | Transition (s, w) ->
×
30
          Transition (s, f_witness w)
×
31
      | Merge (s, p1, p2) ->
×
32
          Merge (s, f_proof p1, f_proof p2)
×
33

34
    let witness (t : (_, _) t) =
35
      match t with Transition (_, witness) -> Some witness | Merge _ -> None
×
36

37
    let statement = function Transition (s, _) -> s | Merge (s, _, _) -> s
×
38

39
    let gen :
40
           'witness Quickcheck.Generator.t
41
        -> 'ledger_proof Quickcheck.Generator.t
42
        -> ('witness, 'ledger_proof) t Quickcheck.Generator.t =
43
     fun gen_witness gen_proof ->
44
      let open Quickcheck.Generator in
×
45
      let gen_transition =
46
        let open Let_syntax in
47
        let%bind statement = Transaction_snark.Statement.gen in
48
        let%map witness = gen_witness in
49
        Transition (statement, witness)
×
50
      in
51
      let gen_merge =
52
        let open Let_syntax in
53
        let%bind statement = Transaction_snark.Statement.gen in
54
        let%map p1, p2 = tuple2 gen_proof gen_proof in
×
55
        Merge (statement, p1, p2)
×
56
      in
57
      union [ gen_transition; gen_merge ]
58
  end
59
end
60

61
module Spec = struct
62
  [%%versioned
63
  module Stable = struct
64
    [@@@no_toplevel_latest_type]
65

66
    module V1 = struct
67
      type 'single t =
12✔
68
        { instances : 'single One_or_two.Stable.V1.t
×
69
        ; fee : Currency.Fee.Stable.V1.t
×
70
        }
71
      [@@deriving fields, sexp, to_yojson]
40✔
72

73
      let to_latest single_latest { instances; fee } =
74
        { instances = One_or_two.Stable.V1.to_latest single_latest instances
×
75
        ; fee
76
        }
77

78
      let of_latest single_latest { instances; fee } =
79
        let open Result.Let_syntax in
×
80
        let%map instances =
81
          One_or_two.Stable.V1.of_latest single_latest instances
×
82
        in
83
        { instances; fee }
×
84
    end
85
  end]
86

87
  type 'single t = 'single Stable.Latest.t =
×
88
    { instances : 'single One_or_two.t; fee : Currency.Fee.t }
×
89
  [@@deriving fields, sexp, yojson]
×
90
end
91

92
module Result = struct
93
  [%%versioned
94
  module Stable = struct
95
    module V1 = struct
96
      type ('spec, 'single) t =
4✔
97
        { proofs : 'single One_or_two.Stable.V1.t
×
98
        ; metrics :
×
99
            (Core.Time.Stable.Span.V1.t * [ `Transition | `Merge ])
100
            One_or_two.Stable.V1.t
101
        ; spec : 'spec
×
102
        ; prover : Signature_lib.Public_key.Compressed.Stable.V1.t
×
103
        }
104
      [@@deriving fields]
24✔
105
    end
106
  end]
107
end
108

109
module Result_without_metrics = struct
110
  type 'proof t =
×
111
    { proofs : 'proof One_or_two.t
×
112
    ; statements : Transaction_snark.Statement.t One_or_two.t
×
113
    ; prover : Signature_lib.Public_key.Compressed.t
×
114
    ; fee : Currency.Fee.t
×
115
    }
116
  [@@deriving yojson, sexp]
×
117
end
32✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc