package tezos-protocol-013-PtJakart

  1. Overview
  2. Docs
Tezos/Protocol: economic-protocol definition

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-16.1.tar.gz
sha256=43723d096307603703a1a89ed1b2eb202b365f5e7824b96b0cbf813b343a6cf7
sha512=b2a637f2e965000d3d49ad85277ca24d6cb07a1a7cf2bc69d296d8b03ad78c3eaa8e21e94b9162e62c2e11649cd03bc845b2a3dafe623b91065df69d47dc8e4f

doc/tezos-protocol-013-PtJakart.raw/Tezos_raw_protocol_013_PtJakart/Script_tc_context/index.html

Module Tezos_raw_protocol_013_PtJakart.Script_tc_contextSource

This module defines the typechecking context used during the translation from Michelson untyped nodes to typed nodes (Script_ir_translator). The context keeps track of the origin of the code (top-level from a contract, in a view, etc.), plus some information to allow or forbid instructions given the context (no `SELF` in a lambda for example).

Sourcetype in_lambda = bool

Lambdas are a bit special when considering stateful instructions such as TRANSFER_TOKENS. For instance, a view containing a TRANSFER_TOKENS is not OK, because calling the view would transfer tokens from the view's owner. However, a view returning a lambda containing a TRANSFER_TOKENS could be considered OK, as the decision whether to execute it or not falls on the view's caller, whose tokens would be transfered. This type is used to keep track of whether we are inside a lambda: it is true when inside a lambda, and false otherwise.

Sourcetype callsite =
  1. | Toplevel : {
    1. storage_type : ('sto, _) Script_typed_ir.ty;
    2. param_type : ('param, _) Script_typed_ir.ty;
    3. entrypoints : 'param Script_typed_ir.entrypoints;
    } -> callsite
  2. | View : callsite
  3. | Data : callsite

The calling context when parsing Michelson code: either a top-level contract code, the code of a view, or code in data (when pushing a block of instructions for example).

Sourcetype t = {
  1. callsite : callsite;
  2. in_lambda : in_lambda;
}
Sourceval init : callsite -> t
Sourceval toplevel : storage_type:('sto, _) Script_typed_ir.ty -> param_type:('param, _) Script_typed_ir.ty -> entrypoints:'param Script_typed_ir.entrypoints -> t
Sourceval view : t
Sourceval data : t

This value can be used outside the translation module as a simple context when testing code, for example.

Sourceval add_lambda : t -> t
Sourceval is_in_lambda : t -> bool
OCaml

Innovation. Community. Security.