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

MinaProtocol / mina / 2908

12 Nov 2024 12:30PM UTC coverage: 36.715% (-25.0%) from 61.682%
2908

push

buildkite

web-flow
Merge pull request #16333 from MinaProtocol/dkijania/port_new_deb_s3_dev

[DEV] Use new version of deb-s3 for validating job publishing

24544 of 66850 relevant lines covered (36.72%)

20720.94 hits per line

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

95.65
/src/lib/mina_base/stack_frame.ml
1
open Core_kernel
23✔
2

3
[%%versioned
4
module Stable = struct
5
  module V1 = struct
6
    type ('caller, 'zkapp_command) t =
115✔
7
      { caller : 'caller; caller_caller : 'caller; calls : 'zkapp_command }
×
8
    [@@deriving make, fields, sexp, yojson]
47✔
9
  end
10
end]
11

12
type value =
13
  ( Token_id.t
14
  , ( Account_update.t
15
    , Zkapp_command.Digest.Account_update.t
16
    , Zkapp_command.Digest.Forest.t )
17
    Zkapp_command.Call_forest.t )
18
  t
19

20
type ('caller, 'zkapp_command) frame = ('caller, 'zkapp_command) t
21

22
let empty : value =
23
  { caller = Token_id.default; caller_caller = Token_id.default; calls = [] }
24

25
module type Stack_frame_digest_intf = sig
26
  include Digest_intf.S
27

28
  val create :
29
       ( Token_id.t
30
       , ( 'p
31
         , Zkapp_command.Digest.Account_update.t
32
         , Zkapp_command.Digest.Forest.t )
33
         Zkapp_command.Call_forest.t )
34
       frame
35
    -> t
36

37
  val gen : t Quickcheck.Generator.t
38

39
  open Pickles.Impls.Step
40

41
  module Checked : sig
42
    include Digest_intf.S_checked
43

44
    val create :
45
         hash_zkapp_command:
46
           ('zkapp_command -> Zkapp_command.Digest.Forest.Checked.t)
47
      -> (Token_id.Checked.t, 'zkapp_command) frame
48
      -> t
49
  end
50

51
  val typ : (Checked.t, t) Typ.t
52
end
53

54
module Wire_types = Mina_wire_types.Mina_base.Stack_frame.Digest
55

56
module Make_sig (A : Wire_types.Types.S) = struct
57
  module type S = Stack_frame_digest_intf with type Stable.V1.t = A.V1.t
58
end
59

60
module Make_str (A : Wire_types.Concrete) = struct
61
  [%%versioned
62
  module Stable = struct
63
    module V1 = struct
64
      type t = Zkapp_basic.F.Stable.V1.t
3✔
65
      [@@deriving sexp, compare, equal, hash, yojson]
115✔
66

67
      let to_latest = Fn.id
68
    end
69
  end]
70

71
  open Pickles.Impls.Step
72

73
  let gen = Field.Constant.gen
74

75
  let to_input (type p)
76
      ({ caller; caller_caller; calls } :
77
        ( Token_id.t
78
        , ( p
79
          , Zkapp_command.Digest.Account_update.t
80
          , Zkapp_command.Digest.Forest.t )
81
          Zkapp_command.Call_forest.t )
82
        frame ) =
83
    List.reduce_exn ~f:Random_oracle.Input.Chunked.append
6✔
84
      [ Token_id.to_input caller
6✔
85
      ; Token_id.to_input caller_caller
6✔
86
      ; Random_oracle.Input.Chunked.field
6✔
87
          (Zkapp_command.Call_forest.hash calls :> Field.Constant.t)
6✔
88
      ]
89

90
  let create frame =
91
    Random_oracle.hash ~init:Hash_prefix_states.account_update_stack_frame
6✔
92
      (Random_oracle.pack_input (to_input frame))
6✔
93

94
  module Checked = struct
95
    include Field
96

97
    let to_input (type zkapp_command)
98
        ~(hash_zkapp_command :
99
           zkapp_command -> Zkapp_command.Digest.Forest.Checked.t )
100
        ({ caller; caller_caller; calls } : _ frame) =
101
      List.reduce_exn ~f:Random_oracle.Input.Chunked.append
420✔
102
        [ Token_id.Checked.to_input caller
420✔
103
        ; Token_id.Checked.to_input caller_caller
420✔
104
        ; Random_oracle.Input.Chunked.field (hash_zkapp_command calls :> Field.t)
420✔
105
        ]
106

107
    let create ~hash_zkapp_command frame =
108
      Random_oracle.Checked.hash
420✔
109
        ~init:Hash_prefix_states.account_update_stack_frame
110
        (Random_oracle.Checked.pack_input (to_input ~hash_zkapp_command frame))
420✔
111
  end
112

113
  let typ = Field.typ
114
end
115

116
module Digest = Wire_types.Make (Make_sig) (Make_str)
117

118
module Checked = struct
119
  type nonrec 'zkapp_command t = (Token_id.Checked.t, 'zkapp_command) t
120

121
  let if_ f b ~then_ ~else_ : _ t =
122
    { caller = Token_id.Checked.if_ b ~then_:then_.caller ~else_:else_.caller
460✔
123
    ; caller_caller =
124
        Token_id.Checked.if_ b ~then_:then_.caller_caller
460✔
125
          ~else_:else_.caller_caller
126
    ; calls = f b ~then_:then_.calls ~else_:else_.calls
460✔
127
    }
128
end
23✔
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