• 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

15.38
/src/lib/transition_frontier/frontier_base/root_data.ml
1
open Core_kernel
3✔
2
open Mina_base
3

4
module Common = struct
5
  [%%versioned
6
  module Stable = struct
7
    module V2 = struct
8
      type t =
6✔
9
        { scan_state : Staged_ledger.Scan_state.Stable.V2.t
10
        ; pending_coinbase : Pending_coinbase.Stable.V2.t
11
        }
15✔
12

13
      let to_latest = Fn.id
14

15
      let to_yojson { scan_state = _; pending_coinbase } =
16
        `Assoc
×
17
          [ ("scan_state", `String "<opaque>")
18
          ; ( "pending_coinbase"
19
            , Pending_coinbase.Stable.V2.to_yojson pending_coinbase )
×
20
          ]
21
    end
22
  end]
23

24
  let create ~scan_state ~pending_coinbase = { scan_state; pending_coinbase }
×
25

26
  let scan_state t = t.scan_state
×
27

28
  let pending_coinbase t = t.pending_coinbase
×
29
end
30

31
module Historical = struct
32
  type t =
33
    { transition : Mina_block.Validated.t
34
    ; common : Common.t
35
    ; staged_ledger_target_ledger_hash : Ledger_hash.t
36
    }
37

38
  let transition t = t.transition
×
39

40
  let staged_ledger_target_ledger_hash t = t.staged_ledger_target_ledger_hash
×
41

42
  let scan_state t = Common.scan_state t.common
×
43

44
  let pending_coinbase t = Common.pending_coinbase t.common
×
45

46
  let of_breadcrumb breadcrumb =
47
    let transition = Breadcrumb.validated_transition breadcrumb in
×
48
    let staged_ledger = Breadcrumb.staged_ledger breadcrumb in
×
49
    let scan_state = Staged_ledger.scan_state staged_ledger in
×
50
    let pending_coinbase =
×
51
      Staged_ledger.pending_coinbase_collection staged_ledger
52
    in
53
    let staged_ledger_target_ledger_hash =
×
54
      Staged_ledger.hash staged_ledger |> Staged_ledger_hash.ledger_hash
×
55
    in
56
    let common = Common.create ~scan_state ~pending_coinbase in
×
57
    { transition; common; staged_ledger_target_ledger_hash }
58
end
59

60
module Limited = struct
61
  [%%versioned
62
  module Stable = struct
63
    module V3 = struct
64
      type t =
6✔
65
        { transition : Mina_block.Validated.Stable.V2.t
66
        ; protocol_states :
67
            Mina_state.Protocol_state.Value.Stable.V2.t
68
            Mina_base.State_hash.With_state_hashes.Stable.V1.t
69
            list
70
        ; common : Common.Stable.V2.t
71
        }
15✔
72

73
      let to_yojson { transition; protocol_states = _; common } =
74
        `Assoc
×
75
          [ ("transition", Mina_block.Validated.Stable.V2.to_yojson transition)
×
76
          ; ("protocol_states", `String "<opaque>")
77
          ; ("common", Common.Stable.V2.to_yojson common)
×
78
          ]
79

80
      let to_latest = Fn.id
81
    end
82
  end]
83

84
  [%%define_locally Stable.Latest.(to_yojson)]
85

86
  let create ~transition ~scan_state ~pending_coinbase ~protocol_states =
87
    let common = { Common.scan_state; pending_coinbase } in
×
88
    { transition; common; protocol_states }
89

90
  let transition t = t.transition
×
91

92
  let hashes t = With_hash.hash @@ Mina_block.Validated.forget t.transition
×
93

94
  let protocol_states t = t.protocol_states
×
95

96
  let scan_state t = Common.scan_state t.common
×
97

98
  let pending_coinbase t = Common.pending_coinbase t.common
×
99
end
100

101
module Minimal = struct
102
  [%%versioned
103
  module Stable = struct
104
    [@@@no_toplevel_latest_type]
105

106
    module V2 = struct
107
      type t = { hash : State_hash.Stable.V1.t; common : Common.Stable.V2.t }
6✔
108
      [@@driving to_yojson]
15✔
109

110
      let to_latest = Fn.id
111
    end
112
  end]
113

114
  type t = Stable.Latest.t = { hash : State_hash.t; common : Common.t }
115
  [@@driving to_yojson]
116

117
  let hash t = t.hash
×
118

119
  let of_limited (l : Limited.t) =
120
    let hash = Mina_block.Validated.state_hash l.transition in
×
121
    { hash; common = l.common }
×
122

123
  let upgrade t ~transition ~protocol_states =
124
    let hash = hash t in
×
125
    assert (State_hash.equal (Mina_block.Validated.state_hash transition) hash) ;
×
126
    let protocol_states =
127
      List.map protocol_states ~f:(fun (state_hash, s) ->
128
          { With_hash.data = s
×
129
          ; hash =
130
              { Mina_base.State_hash.State_hashes.state_hash
131
              ; state_body_hash = None
132
              }
133
          } )
134
    in
135
    ignore
×
136
      ( Staged_ledger.Scan_state.check_required_protocol_states
×
137
          t.common.scan_state ~protocol_states
138
        |> Or_error.ok_exn
×
139
        : Mina_state.Protocol_state.value State_hash.With_state_hashes.t list ) ;
140
    { Limited.transition; protocol_states; common = t.common }
141

142
  let create ~hash ~scan_state ~pending_coinbase =
143
    let common = { Common.scan_state; pending_coinbase } in
×
144
    { hash; common }
145

146
  let scan_state t = Common.scan_state t.common
×
147

148
  let pending_coinbase t = Common.pending_coinbase t.common
×
149
end
150

151
type t =
152
  { transition : Mina_block.Validated.t
153
  ; staged_ledger : Staged_ledger.t
154
  ; protocol_states :
155
      Mina_state.Protocol_state.Value.t Mina_base.State_hash.With_state_hashes.t
156
      list
157
  }
158

159
let minimize { transition; staged_ledger; protocol_states = _ } =
160
  let scan_state = Staged_ledger.scan_state staged_ledger in
×
161
  let pending_coinbase =
×
162
    Staged_ledger.pending_coinbase_collection staged_ledger
163
  in
164
  let common = Common.create ~scan_state ~pending_coinbase in
×
165
  { Minimal.hash = Mina_block.Validated.state_hash transition; common }
×
166

167
let limit { transition; staged_ledger; protocol_states } =
168
  let scan_state = Staged_ledger.scan_state staged_ledger in
×
169
  let pending_coinbase =
×
170
    Staged_ledger.pending_coinbase_collection staged_ledger
171
  in
172
  let common = Common.create ~scan_state ~pending_coinbase in
×
173
  { Limited.transition; common; protocol_states }
6✔
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