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

MinaProtocol / mina / 2903

15 Nov 2024 01:59PM UTC coverage: 36.723% (-25.0%) from 61.682%
2903

Pull #16342

buildkite

dkijania
Merge branch 'dkijania/remove_publish_job_from_pr_comp' into dkijania/remove_publish_job_from_pr_dev
Pull Request #16342: [DEV] Publish debians only on nightly and stable

15 of 40 new or added lines in 14 files covered. (37.5%)

15175 existing lines in 340 files now uncovered.

24554 of 66863 relevant lines covered (36.72%)

20704.91 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
4✔
2
open Async_kernel
3
open Pipe_lib
4

5
let trust_system = Trust_system.null ()
4✔
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 =
UNCOV
39
    List.iter stmts ~f:(fun s ->
×
UNCOV
40
        Transaction_snark_work.Statement.Table.change table s ~f:(function
×
UNCOV
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 =
UNCOV
48
    let refcount_table = Transaction_snark_work.Statement.Table.create () in
×
49
    (*add_statements table stmts ;*)
UNCOV
50
    let diff_reader, diff_writer =
×
51
      Broadcast_pipe.create { Extensions.Snark_pool_refcount.removed_work = [] }
52
    in
UNCOV
53
    { refcount_table
×
54
    ; best_tip_table = Transaction_snark_work.Statement.Set.empty
UNCOV
55
    ; ledger = Mina_ledger.Ledger.create_ephemeral ~depth:10 ()
×
56
    ; diff_writer
57
    ; diff_reader
58
    }
59

UNCOV
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 =
UNCOV
67
    t.diff_reader
×
68

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

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

UNCOV
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 =
UNCOV
79
    let open Deferred.Let_syntax in
×
80
    add_statements t.refcount_table stmts ;
UNCOV
81
    t.best_tip_table <- List.fold ~f:Set.add ~init:t.best_tip_table stmts ;
×
82
    let%bind () =
UNCOV
83
      Broadcast_pipe.Writer.write t.diff_writer
×
84
        { Transition_frontier.Extensions.Snark_pool_refcount.removed_work = [] }
85
    in
UNCOV
86
    Async.Scheduler.yield_until_no_jobs_remain ()
×
87

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