package tezos-protocol-013-PtJakart

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

Michelson Existential Witness types

type ('ta, 'tb) eq =
  1. | Eq : ('same, 'same) eq
type ex_comparable_ty =
  1. | Ex_comparable_ty : 'a Script_typed_ir.comparable_ty -> ex_comparable_ty
type ex_ty =
  1. | Ex_ty : ('a, _) Script_typed_ir.ty -> ex_ty
type ex_parameter_ty_and_entrypoints =
  1. | Ex_parameter_ty_and_entrypoints : {
    1. arg_type : ('a, _) Script_typed_ir.ty;
    2. entrypoints : 'a Script_typed_ir.entrypoints;
    } -> ex_parameter_ty_and_entrypoints
type ex_stack_ty =
  1. | Ex_stack_ty : ('a, 's) Script_typed_ir.stack_ty -> ex_stack_ty
type ex_script =
  1. | Ex_script : ('a, 'b) Script_typed_ir.script -> ex_script
type toplevel = {
  1. code_field : Alpha_context.Script.node;
  2. arg_type : Alpha_context.Script.node;
  3. storage_type : Alpha_context.Script.node;
  4. views : Script_typed_ir.view_map;
}
type ('arg, 'storage) code =
  1. | Code : {
    1. code : (('arg, 'storage) Script_typed_ir.pair, (Script_typed_ir.operation Script_typed_ir.boxed_list, 'storage) Script_typed_ir.pair) Script_typed_ir.lambda;
    2. arg_type : ('arg, _) Script_typed_ir.ty;
    3. storage_type : ('storage, _) Script_typed_ir.ty;
    4. views : Script_typed_ir.view_map;
    5. entrypoints : 'arg Script_typed_ir.entrypoints;
    6. code_size : Cache_memory_helpers.sint;
      (*

      This is an over-approximation of the value size in memory, in bytes, of the contract's static part, that is its source code. This includes the code of the contract as well as the code of the views. The storage size is not taken into account by this field as it has a dynamic size.

      *)
    } -> ('arg, 'storage) code
type ex_code =
  1. | Ex_code : ('a, 'c) code -> ex_code
type 'storage typed_view =
  1. | Typed_view : {
    1. input_ty : ('input, _) Script_typed_ir.ty;
    2. output_ty : ('output, _) Script_typed_ir.ty;
    3. kinstr : ('input * 'storage, Script_typed_ir.end_of_stack, 'output, Script_typed_ir.end_of_stack) Script_typed_ir.kinstr;
    4. original_code_expr : Alpha_context.Script.node;
    } -> 'storage typed_view
type 'storage typed_view_map = (Alpha_context.Script_string.t, 'storage typed_view) Script_typed_ir.map
type ('a, 's, 'b, 'u) cinstr = {
  1. apply : 'r 'f. ('a, 's) Script_typed_ir.kinfo -> ('b, 'u, 'r, 'f) Script_typed_ir.kinstr -> ('a, 's, 'r, 'f) Script_typed_ir.kinstr;
}
type ('a, 's, 'b, 'u) descr = {
  1. loc : Alpha_context.Script.location;
  2. bef : ('a, 's) Script_typed_ir.stack_ty;
  3. aft : ('b, 'u) Script_typed_ir.stack_ty;
  4. instr : ('a, 's, 'b, 'u) cinstr;
}
type tc_context = Script_tc_context.t
type ('a, 's) judgement =
  1. | Typed : ('a, 's, 'b, 'u) descr -> ('a, 's) judgement
  2. | Failed : {
    1. descr : 'b 'u. ('b, 'u) Script_typed_ir.stack_ty -> ('a, 's, 'b, 'u) descr;
    } -> ('a, 's) judgement
val close_descr : ('a, 'b, 'c, 'd) descr -> ('a, 'b, 'c, 'd) Script_typed_ir.kdescr
type unparsing_mode =
  1. | Optimized
  2. | Readable
  3. | Optimized_legacy

Flag that drives unparsing of typed values to nodes.

  • Optimized_legacy must be kept backward-compatible in order to compute valid hashes (of big map keys).
  • Optimized may be used as long as the result can be read by parse_data.
  • Readable produces with string values instead of bytes when feasible.
type type_logger = Alpha_context.Script.location -> stack_ty_before:Alpha_context.Script.expr list -> stack_ty_after:Alpha_context.Script.expr list -> unit

High-level Michelson Data Types

val empty_big_map : 'a Script_typed_ir.comparable_ty -> ('b, _) Script_typed_ir.ty -> ('a, 'b) Script_typed_ir.big_map

Create an empty big_map

Update a big map, returning the old value of the given key and the new map.

This does not modify the underlying storage, only the diff table.

val ty_eq : error_details:'error_trace Script_tc_errors.error_details -> Alpha_context.Script.location -> ('a, 'ac) Script_typed_ir.ty -> ('b, 'bc) Script_typed_ir.ty -> ((('a, 'ac) Script_typed_ir.ty, ('b, 'bc) Script_typed_ir.ty) eq, 'error_trace) Gas_monad.t

parse_ty specialized for the right-hand side part of a big map type, i.e. the `value` in `big_map key value`.

parse_ty allowing big_map values, operations, contract and tickets.

val parse_ty : Alpha_context.context -> legacy:bool -> allow_lazy_storage:bool -> allow_operation:bool -> allow_contract:bool -> allow_ticket:bool -> Alpha_context.Script.node -> (ex_ty * Alpha_context.context) Tezos_protocol_environment_013_PtJakart.Error_monad.tzresult

We expose parse_ty for convenience to external tools. Please use specialized versions such as parse_packable_ty, parse_passable_ty, parse_comparable_ty, or parse_big_map_value_ty if possible.

High-level function to typecheck a Michelson script. This function is not used for validating operations but only for the typecheck_code RPC.

If show_types is set to true, details of the typechecking are returned in the type_map, otherwise the returned type_map is empty.

val serialize_ty_for_error : ('a, _) Script_typed_ir.ty -> Alpha_context.Script.expr

Combines parse_code and parse_storage

type 'a ex_ty_cstr =
  1. | Ex_ty_cstr : {
    1. ty : ('b, _) Script_typed_ir.ty;
    2. construct : 'b -> 'a;
    3. original_type_expr : Alpha_context.Script.node;
    } -> 'a ex_ty_cstr

'a ex_ty_cstr is like ex_ty, but also adds to the existential a function used to reconstruct a value of type 'a from the internal type of the existential. Typically, it will be used to go from the type of an entry-point to the full type of a contract.

val find_entrypoint : error_details:'error_trace Script_tc_errors.error_details -> ('t, _) Script_typed_ir.ty -> 't Script_typed_ir.entrypoints -> Alpha_context.Entrypoint.t -> ('t ex_ty_cstr, 'error_trace) Gas_monad.t
type lazy_storage_ids
val no_lazy_storage_id : lazy_storage_ids
val list_of_big_map_ids : lazy_storage_ids -> Alpha_context.Big_map.Id.t list

Produce a lazy storage diff, containing in-memory writes to lazy data structures such as big_maps yet to be committed.

The resulting diff can be committed to the underlying storage (context) using Lazy_storage_diff.apply.

  • parameter to_duplicate

    Lazy data structure reference produced via collect_lazy_storage that can not be reused. Typically collected via traversing the parameters to a smart contract.

  • parameter to_update

    Lazy data structure reference produced via collect_lazy_storage that can be reused. Typically collected via traversing the previous storage of a smart contract.

code_size ctxt code views returns an overapproximation of the size of the in-memory representation of code and views in bytes in the context ctxt.

val script_size : ex_script -> int * Gas_limit_repr.cost

script_size script returns an overapproximation of the size of the in-memory representation of script in bytes as well as the cost associated to computing that overapproximation.

OCaml

Innovation. Community. Security.