• 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

9.09
/src/lib/network_pool/mocks.ml
1
open Core_kernel
1✔
2
open Async_kernel
3
open Pipe_lib
4

5
let trust_system = Trust_system.null ()
1✔
6

7
module Transaction_snark_work = Transaction_snark_work
8
module Base_ledger = Mina_ledger.Ledger
9

10
module Staged_ledger = struct
11
  type t = Base_ledger.t [@@deriving sexp]
×
12

13
  let ledger = Fn.id
14
end
15

16
module Transition_frontier = struct
17
  type table = int Transaction_snark_work.Statement.Table.t [@@deriving sexp]
×
18

19
  type diff = Extensions.Snark_pool_refcount.view [@@deriving sexp]
×
20

21
  type best_tip_diff = unit
22

23
  module Breadcrumb = struct
24
    type t = Staged_ledger.t
25

26
    let staged_ledger = Fn.id
27
  end
28

29
  type t =
×
30
    { refcount_table : table
×
31
    ; mutable best_tip_table : Transaction_snark_work.Statement.Set.t
×
32
    ; mutable ledger : Base_ledger.t
×
33
    ; diff_writer : (diff Broadcast_pipe.Writer.t[@sexp.opaque])
×
34
    ; diff_reader : (diff Broadcast_pipe.Reader.t[@sexp.opaque])
×
35
    }
36
  [@@deriving sexp]
37

38
  let add_statements table stmts =
39
    List.iter stmts ~f:(fun s ->
×
40
        Transaction_snark_work.Statement.Table.change table s ~f:(function
×
41
          | None ->
×
42
              Some 1
43
          | Some count ->
×
44
              Some (count + 1) ) )
45

46
  (*Create tf with some statements referenced to be able to add snark work for those statements to the pool*)
47
  let create _stmts : t =
48
    let refcount_table = Transaction_snark_work.Statement.Table.create () in
×
49
    (*add_statements table stmts ;*)
50
    let diff_reader, diff_writer =
×
51
      Broadcast_pipe.create { Extensions.Snark_pool_refcount.removed_work = [] }
52
    in
53
    { refcount_table
×
54
    ; best_tip_table = Transaction_snark_work.Statement.Set.empty
55
    ; ledger = Mina_ledger.Ledger.create_ephemeral ~depth:10 ()
×
56
    ; diff_writer
57
    ; diff_reader
58
    }
59

60
  let best_tip t = t.ledger
×
61

62
  module Extensions = struct
63
    module Work = Transaction_snark_work.Statement
64
  end
65

66
  let snark_pool_refcount_pipe (t : t) : diff Broadcast_pipe.Reader.t =
67
    t.diff_reader
×
68

69
  let best_tip_diff_pipe _ =
70
    let r, _ = Broadcast_pipe.create () in
×
71
    r
×
72

73
  let work_is_referenced t = Hashtbl.mem t.refcount_table
×
74

75
  let best_tip_table t = t.best_tip_table
×
76

77
  (*Adds statements to the table of referenced work. Snarks for only the referenced statements are added to the pool*)
78
  let refer_statements (t : t) stmts =
79
    let open Deferred.Let_syntax in
×
80
    add_statements t.refcount_table stmts ;
81
    t.best_tip_table <- List.fold ~f:Set.add ~init:t.best_tip_table stmts ;
×
82
    let%bind () =
83
      Broadcast_pipe.Writer.write t.diff_writer
×
84
        { Transition_frontier.Extensions.Snark_pool_refcount.removed_work = [] }
85
    in
86
    Async.Scheduler.yield_until_no_jobs_remain ()
×
87

88
  let remove_from_best_tip (t : t) stmts =
89
    t.best_tip_table <- List.fold ~f:Set.remove ~init:t.best_tip_table stmts ;
×
90
    let%bind () =
91
      Broadcast_pipe.Writer.write t.diff_writer
×
92
        { Transition_frontier.Extensions.Snark_pool_refcount.removed_work = [] }
93
    in
94
    Async.Scheduler.yield_until_no_jobs_remain ()
×
95
end
1✔
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