package octez-proto-libs

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file environment_context_intf.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
(*****************************************************************************)
(*                                                                           *)
(* Open Source License                                                       *)
(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com>     *)
(* Copyright (c) 2021 Tarides <contact@tarides.com>                          *)
(* Copyright (c) 2021 Nomadic Labs, <contact@nomadic-labs.com>               *)
(*                                                                           *)
(* Permission is hereby granted, free of charge, to any person obtaining a   *)
(* copy of this software and associated documentation files (the "Software"),*)
(* to deal in the Software without restriction, including without limitation *)
(* the rights to use, copy, modify, merge, publish, distribute, sublicense,  *)
(* and/or sell copies of the Software, and to permit persons to whom the     *)
(* Software is furnished to do so, subject to the following conditions:      *)
(*                                                                           *)
(* The above copyright notice and this permission notice shall be included   *)
(* in all copies or substantial portions of the Software.                    *)
(*                                                                           *)
(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)
(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  *)
(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL   *)
(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)
(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING   *)
(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER       *)
(* DEALINGS IN THE SOFTWARE.                                                 *)
(*                                                                           *)
(*****************************************************************************)

module Kind = struct
  type t = [`Value | `Tree]
end

module type VIEW = sig
  (** @inline *)
  include Tezos_context_sigs.Context.VIEW
end

module type TREE = sig
  (** @inline *)
  include Tezos_context_sigs.Context.TREE
end

module type PROOF = sig
  (** @inline *)
  include Tezos_context_sigs.Context.PROOF
end

module type PROOF_ENCODING = sig
  (** @inline *)
  include Tezos_context_sigs.Context.PROOF_ENCODING
end

module type HASH_VERSION = sig
  (** @inline *)
  include Tezos_context_sigs.Context.HASH_VERSION
end

(* Copy of sigs/v3/context.mli:CACHE *)
module type CACHE = sig
  type t

  type size

  type index

  type identifier

  type key

  type value = ..

  val key_of_identifier : cache_index:index -> identifier -> key

  val identifier_of_key : key -> identifier

  val pp : Format.formatter -> t -> unit

  val find : t -> key -> value option Lwt.t

  val set_cache_layout : t -> size list -> t Lwt.t

  val update : t -> key -> (value * size) option -> t

  val sync : t -> cache_nonce:Bytes.t -> t Lwt.t

  val clear : t -> t

  val list_keys : t -> cache_index:index -> (key * size) list option

  val key_rank : t -> key -> int option

  val future_cache_expectation : t -> time_in_blocks:int -> t

  val cache_size : t -> cache_index:index -> size option

  val cache_size_limit : t -> cache_index:index -> size option
end

module type CORE = sig
  type t

  val set_protocol : t -> Tezos_crypto.Hashed.Protocol_hash.t -> t Lwt.t

  val get_protocol : t -> Tezos_crypto.Hashed.Protocol_hash.t Lwt.t

  val fork_test_chain :
    t ->
    protocol:Tezos_crypto.Hashed.Protocol_hash.t ->
    expiration:Time.Protocol.t ->
    t Lwt.t

  val set_hash_version :
    t -> Tezos_crypto.Hashed.Context_hash.Version.t -> t tzresult Lwt.t

  val get_hash_version : t -> Tezos_crypto.Hashed.Context_hash.Version.t
end

module type TREE_CORE = sig
  type t

  type tree

  type value

  val empty : t -> tree

  val is_empty : tree -> bool

  val kind : tree -> Kind.t

  val to_value : tree -> value option Lwt.t

  val of_value : t -> value -> tree Lwt.t

  val hash : tree -> Tezos_crypto.Hashed.Context_hash.t

  val equal : tree -> tree -> bool

  val clear : ?depth:int -> tree -> unit
end

module V2 = struct
  type depth = [`Eq of int | `Le of int | `Lt of int | `Ge of int | `Gt of int]

  module type VIEW = sig
    type t

    type key

    type value

    type tree

    val mem : t -> key -> bool Lwt.t

    val mem_tree : t -> key -> bool Lwt.t

    val find : t -> key -> value option Lwt.t

    val find_tree : t -> key -> tree option Lwt.t

    val list :
      t -> ?offset:int -> ?length:int -> key -> (string * tree) trace Lwt.t

    val add : t -> key -> value -> t Lwt.t

    val add_tree : t -> key -> tree -> t Lwt.t

    val remove : t -> key -> t Lwt.t

    val fold :
      ?depth:depth ->
      t ->
      key ->
      init:'a ->
      f:(key -> tree -> 'a -> 'a Lwt.t) ->
      'a Lwt.t
  end

  module Kind = Kind

  module type TREE = sig
    type t

    type tree

    include VIEW with type t := tree and type tree := tree

    include
      TREE_CORE with type t := t and type tree := tree and type value := value
  end

  module type S = sig
    include VIEW with type key = string list and type value = bytes

    module Tree : sig
      include
        TREE
          with type t := t
           and type key := key
           and type value := value
           and type tree := tree

      val pp : Format.formatter -> tree -> unit
    end

    include CORE with type t := t
  end
end

module V3 = V2

module V4 = struct
  type depth = V3.depth

  module type VIEW = sig
    include V3.VIEW

    val fold :
      ?depth:depth ->
      t ->
      key ->
      order:[`Sorted | `Undefined] ->
      init:'a ->
      f:(key -> tree -> 'a -> 'a Lwt.t) ->
      'a Lwt.t
  end

  module Kind = Kind

  module type TREE = sig
    type t

    type tree

    include VIEW with type t := tree and type tree := tree

    include
      TREE_CORE with type t := t and type tree := tree and type value := value
  end

  module type S = sig
    include VIEW with type key = string list and type value = bytes

    module Tree : sig
      include
        TREE
          with type t := t
           and type key := key
           and type value := value
           and type tree := tree

      val pp : Format.formatter -> tree -> unit
    end

    include CORE with type t := t
  end

  module type CACHE = CACHE
end

module V5 = struct
  type depth = V4.depth

  type config = Tezos_context_sigs.Config.t

  let equal_config = Tezos_context_sigs.Config.equal

  module type VIEW = VIEW

  module Kind = Kind

  module type TREE = TREE

  module type S = sig
    val equal_config : config -> config -> bool

    include VIEW with type key = string list and type value = bytes

    module Tree : sig
      include
        TREE
          with type t := t
           and type key := key
           and type value := value
           and type tree := tree

      val pp : Format.formatter -> tree -> unit
    end

    include CORE with type t := t

    module Proof : PROOF

    type tree_proof := Proof.tree Proof.t

    type stream_proof := Proof.stream Proof.t

    type ('proof, 'result) verifier :=
      'proof ->
      (tree -> (tree * 'result) Lwt.t) ->
      ( tree * 'result,
        [ `Proof_mismatch of string
        | `Stream_too_long of string
        | `Stream_too_short of string ] )
      result
      Lwt.t

    val verify_tree_proof : (tree_proof, 'a) verifier

    val verify_stream_proof : (stream_proof, 'a) verifier
  end

  module type CACHE = CACHE
end

module V6 = V5
module V7 = V6
module V8 = V7
module V9 = V8
module V10 = V9
module V11 = V10
module V12 = V11

module type S = V7.S

module type Sigs = sig
  module V2 = V2
  module V3 = V3
  module V4 = V4
  module V5 = V5
  module V6 = V6
  module V7 = V7
  module V8 = V8
  module V9 = V9
  module V10 = V10
  module V11 = V11
  module V12 = V12

  module type VIEW = VIEW

  module type TREE = TREE

  module type S = S

  module type HASH_VERSION = HASH_VERSION

  module type CACHE = CACHE
end
OCaml

Innovation. Community. Security.