package tezos-protocol-017-PtNairob

  1. Overview
  2. Docs
Tezos protocol 017-PtNairob package

Install

Dune Dependency

Authors

Maintainers

Sources

octez-19.0.tar.gz
sha256=c6df840ebbf115e454db949028c595bec558a59a66cade73b52a6d099d6fa4d4
sha512=d8aee903b9fe130d73176bc8ec38b78c9ff65317da3cb4f3415f09af0c625b4384e7498201fdb61aa39086a7d5d409d0ab3423f9bc3ab989a680cf444a79bc13

doc/src/tezos_raw_protocol_017_PtNairob/script_ir_translator_config.ml.html

Source file script_ir_translator_config.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
(*****************************************************************************)
(*                                                                           *)
(* Open Source License                                                       *)
(* Copyright (c) 2022 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.                                                 *)
(*                                                                           *)
(*****************************************************************************)

open Alpha_context

(** [type_logger] is a function, whose task is to log how a stack's type
   is altered by some operation being logged. *)
type type_logger =
  Script.location ->
  stack_ty_before:Script.expr list ->
  stack_ty_after:Script.expr list ->
  unit

(** LEGACY MODE is the feature of the Translator and Interpreter which
    allows us to distinguish between scripts already originated on chain
    and new ones.

    The reason to treat those types of scripts differently is the evolving
    nature of Michelson, which sometimes requires disabling features
    available in previous versions. These features must be supported at all
    times for already originated contracts, but we still want to disable
    them at least for new contracts.

    This distinction gives us a handy deprecation mechanism, which
    allows us to make sure that from a certain point on no more
    contract will be originated using these deprecated features. When
    that point time is reached, it becomes possible to patch existing
    contracts so that they no longer use the feature and remove it
    entirely.

    As a side effect, legacy mode can also be used to skip checks that
    have already been performed and hence are guaranteed to pass.*)

(** [elab_config] is a record grouping together some flags and options
    shared by many of the functions in [Script_ir_translator]. It's
    convenient to group them together, because they're of similar
    types ([bool] or ['a option]), so they're easier not to mix together.
    It also makes for shorter and more readable function calls. *)
type elab_config = {
  type_logger : type_logger option;
      (** A function responsible for logging stack types during typechecking.
        Used especially in plugins for editors and IDEs. *)
  keep_extra_types_for_interpreter_logging : bool;
      (** If set to [true], it instructs the elaborator to retain some
        additional type information necessary for logging. This should
        never be enabled during validation to save memory occupied by
        cached contracts.

        NOTE: if this option wasn't passed to the elaborator and the 
        interpreter was still called with logging enabled, it might
        result in a crash. This cannot be helped at the moment, but since 
        logging is never enabled during validation, we should be safe. *)
  legacy : bool;  (** If set to true, it enables the legacy mode (see above). *)
}

(** [make ?type_logger ?logging_enabled ~legacy ()] creates an [elab_config]
    record to be passed to parsing functions in [Script_ir_translator].

    Note: [?logging_enabled] defaults to [false], because it only ever should
    be set to [true] if the Translator is called from outside the protocol
    (i.e. from the Plugin). *)
let make :
    ?type_logger:type_logger ->
    ?keep_extra_types_for_interpreter_logging:bool ->
    legacy:bool ->
    unit ->
    elab_config =
 fun ?type_logger ?(keep_extra_types_for_interpreter_logging = false) ~legacy () ->
  {type_logger; keep_extra_types_for_interpreter_logging; legacy}
OCaml

Innovation. Community. Security.