• 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

73.68
/src/lib/staged_ledger_diff/body.ml
1
open Core_kernel
4✔
2
module Wire_types = Mina_wire_types.Staged_ledger_diff.Body
3

4
module Make_sig (A : Wire_types.Types.S) = struct
5
  module type S = Body_intf.Full with type Stable.V1.t = A.V1.t
6
end
7

8
module Make_str (A : Wire_types.Concrete) = struct
9
  (* TODO Consider moving to a different location. as in future this won't be only about block body *)
10
  module Tag = struct
11
    type t = Body [@@deriving enum]
404✔
12
    (* In future: | EpochLedger |... *)
13
  end
14

15
  [%%versioned
16
  module Stable = struct
17
    module V1 = struct
18
      type t = A.V1.t = { staged_ledger_diff : Diff.Stable.V2.t }
×
19
      [@@deriving equal, compare, sexp, fields]
20✔
20

21
      let to_latest = Fn.id
22

23
      let to_yojson _ = `String "<opaque>"
×
24

25
      module Creatable = struct
26
        let id = "block_body"
27

28
        type nonrec t = t
29

30
        let sexp_of_t = sexp_of_t
31

32
        let t_of_sexp = t_of_sexp
33

34
        type 'a creator = Diff.Stable.Latest.t -> 'a
35

36
        let map_creator c ~f staged_ledger_diff = f (c staged_ledger_diff)
224✔
37

38
        let create staged_ledger_diff = { staged_ledger_diff }
224✔
39
      end
40

41
      include (
42
        Allocation_functor.Make.Basic
43
          (Creatable) :
44
            Allocation_functor.Intf.Output.Basic_intf
45
              with type t := t
46
               and type 'a creator := 'a Creatable.creator )
47

48
      include (
49
        Allocation_functor.Make.Sexp
50
          (Creatable) :
51
            Allocation_functor.Intf.Output.Sexp_intf
52
              with type t := t
53
               and type 'a creator := 'a Creatable.creator )
54
    end
55
  end]
56

57
  type t = Stable.Latest.t
58

59
  [%%define_locally
60
  Stable.Latest.
61
    (create, to_yojson, sexp_of_t, t_of_sexp, equal, compare, staged_ledger_diff)]
62

63
  let to_binio_bigstring b =
64
    let sz = Stable.V1.bin_size_t b in
×
65
    let buf = Bin_prot.Common.create_buf sz in
×
66
    ignore (Stable.V1.bin_write_t buf ~pos:0 b : int) ;
×
67
    buf
68

69
  let serialize_with_len_and_tag b =
70
    let len = Stable.V1.bin_size_t b in
404✔
71
    let bs' = Bigstring.create (len + 5) in
404✔
72
    ignore (Stable.V1.bin_write_t bs' ~pos:5 b : int) ;
404✔
73
    Bigstring.set_uint8_exn ~pos:4 bs' (Tag.to_enum Body) ;
404✔
74
    Bigstring.set_uint32_le_exn ~pos:0 bs' (len + 1) ;
404✔
75
    bs'
404✔
76

77
  let compute_reference =
78
    Fn.compose snd
4✔
79
    @@ Fn.compose
4✔
80
         (Bitswap_block.blocks_of_data ~max_block_size:262144)
81
         serialize_with_len_and_tag
82
end
83

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