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

MinaProtocol / mina / 2863

05 Nov 2024 06:20PM UTC coverage: 30.754% (-16.6%) from 47.311%
2863

push

buildkite

web-flow
Merge pull request #16296 from MinaProtocol/dkijania/more_multi_jobs

more multi jobs in CI

20276 of 65930 relevant lines covered (30.75%)

8631.7 hits per line

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

5.56
/src/lib/protocol_version/protocol_version.ml
1
(* protocol_version.ml *)
2

3
(* see RFC 0049 for details *)
4

5
open Core_kernel
6
module Wire_types = Mina_wire_types.Protocol_version
7

8
module Make_sig (A : Wire_types.Types.S) = struct
9
  module type S = Protocol_version_intf.Full with type Stable.V2.t = A.V2.t
10
end
11

12
module Make_str (A : Wire_types.Concrete) = struct
13
  [%%versioned
14
  module Stable = struct
15
    module V2 = struct
16
      type t = A.V2.t = { transaction : int; network : int; patch : int }
×
17
      [@@deriving compare, equal, sexp, yojson, fields]
45✔
18

19
      let to_latest = Fn.id
20
    end
21
  end]
22

23
  include Comparable.Make (Stable.V2)
24

25
  let create = Fields.create
26

27
  let of_string_exn s =
28
    let is_digit_string s = String.for_all s ~f:Char.is_digit in
×
29
    match String.split s ~on:'.' with
30
    | [ transaction; network; patch ] ->
×
31
        if
32
          not
33
            ( is_digit_string transaction
×
34
            && is_digit_string network && is_digit_string patch )
×
35
        then failwith "Unexpected nondigits in input" ;
×
36
        { transaction = Int.of_string transaction
×
37
        ; network = Int.of_string network
×
38
        ; patch = Int.of_string patch
×
39
        }
40
    | _ ->
×
41
        failwith
42
          "Protocol_version.of_string_exn: expected string of form nn.nn.nn"
43

44
  let of_string_opt s = try Some (of_string_exn s) with _ -> None
×
45

46
  let to_string t = sprintf "%u.%u.%u" t.transaction t.network t.patch
×
47

48
  let current_transaction = Node_config_version.protocol_version_transaction
49

50
  let current_network = Node_config_version.protocol_version_network
51

52
  let current_patch = Node_config_version.protocol_version_patch
53

54
  let current =
55
    { transaction = current_transaction
56
    ; network = current_network
57
    ; patch = current_patch
58
    }
59

60
  let (proposed_protocol_version_opt : t option ref) = ref None
61

62
  let set_proposed_opt t_opt = proposed_protocol_version_opt := t_opt
×
63

64
  let get_proposed_opt () = !proposed_protocol_version_opt
×
65

66
  let compatible_with_daemon (t : t) =
67
    (* patch not considered for compatibility *)
68
    Int.equal t.transaction current.transaction
×
69
    && Int.equal t.network current.network
×
70

71
  (* when an external transition is deserialized, might contain
72
     negative numbers
73
  *)
74
  let is_valid t = Int.(t.transaction >= 1 && t.network >= 0 && t.patch >= 0)
×
75
end
76

77
include Wire_types.Make (Make_sig) (Make_str)
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