package tezos-protocol-017-PtNairob
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=7062cd57addd452852598a2214ade393130efa087b99068d53713bdf912b3680
sha512=08e4091144a03ce3c107fb91a66501bd8b65ca3278917c455a2eaac6df3e108ade63f6ab8340a4bb152d60f404326e464d0ec95d26cafe8e82f870465d24a5fc
doc/tezos-protocol-017-PtNairob.raw/Tezos_raw_protocol_017_PtNairob/Script_tc_context/index.html
Module Tezos_raw_protocol_017_PtNairob.Script_tc_context
Source
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).
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.
type callsite =
| Toplevel : {
storage_type : ('sto, _) Script_typed_ir.ty;
param_type : ('param, _) Script_typed_ir.ty;
entrypoints : 'param Script_typed_ir.entrypoints;
} -> callsite
| View : callsite
| 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).
val toplevel :
storage_type:('sto, _) Script_typed_ir.ty ->
param_type:('param, _) Script_typed_ir.ty ->
entrypoints:'param Script_typed_ir.entrypoints ->
t
This value can be used outside the translation module as a simple context when testing code, for example.
val check_not_in_view :
Alpha_context.Script.location ->
legacy:bool ->
t ->
Alpha_context.Script.prim ->
unit Tezos_protocol_environment_017_PtNairob.Error_monad.tzresult