package tezos-protocol-alpha
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
sha256=43723d096307603703a1a89ed1b2eb202b365f5e7824b96b0cbf813b343a6cf7
    
    
  sha512=b2a637f2e965000d3d49ad85277ca24d6cb07a1a7cf2bc69d296d8b03ad78c3eaa8e21e94b9162e62c2e11649cd03bc845b2a3dafe623b91065df69d47dc8e4f
    
    
  doc/tezos-protocol-alpha.raw/Tezos_raw_protocol_alpha/Script_ir_translator/index.html
Module Tezos_raw_protocol_alpha.Script_ir_translatorSource
Michelson Existential Witness types
type ex_comparable_ty = - | Ex_comparable_ty : 'a Script_typed_ir.comparable_ty -> ex_comparable_ty
type ex_parameter_ty_and_entrypoints = - | Ex_parameter_ty_and_entrypoints : {- arg_type : ('a, _) Script_typed_ir.ty;
- entrypoints : 'a Script_typed_ir.entrypoints;
 - } -> ex_parameter_ty_and_entrypoints
type toplevel = {- code_field : Alpha_context.Script.node;
- arg_type : Alpha_context.Script.node;
- storage_type : Alpha_context.Script.node;
- views : Script_typed_ir.view_map;
}type ('arg, 'storage) code = - | Code : {- code : (('arg, 'storage) Script_typed_ir.pair, (Script_typed_ir.operation Script_list.t, 'storage) Script_typed_ir.pair) Script_typed_ir.lambda;
- arg_type : ('arg, _) Script_typed_ir.ty;
- storage_type : ('storage, _) Script_typed_ir.ty;
- views : Script_typed_ir.view_map;
- entrypoints : 'arg Script_typed_ir.entrypoints;
- 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 'storage typed_view = - | Typed_view : {- input_ty : ('input, _) Script_typed_ir.ty;
- output_ty : ('output, _) Script_typed_ir.ty;
- kinstr : ('input * 'storage, Script_typed_ir.end_of_stack, 'output, Script_typed_ir.end_of_stack) Script_typed_ir.kinstr;
- original_code_expr : Alpha_context.Script.node;
 - } -> 'storage typed_view
type ('a, 's, 'b, 'u) cinstr = {- apply : 'r 'f. ('b, 'u, 'r, 'f) Script_typed_ir.kinstr -> ('a, 's, 'r, 'f) Script_typed_ir.kinstr;
}type ('a, 's, 'b, 'u) descr = {- loc : Alpha_context.Script.location;
- bef : ('a, 's) Script_typed_ir.stack_ty;
- aft : ('b, 'u) Script_typed_ir.stack_ty;
- instr : ('a, 's, 'b, 'u) cinstr;
}val ty_eq : 
  error_details:
    (Alpha_context.Script.location, 'error_trace)
      Script_tc_errors.error_details ->
  ('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.tHigh-level Michelson Data Types
val parse_comparable_data : 
  ?type_logger:Script_ir_translator_config.type_logger ->
  Alpha_context.context ->
  'a Script_typed_ir.comparable_ty ->
  Alpha_context.Script.node ->
  ('a * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tParsing and Typechecking Michelson
val parse_data : 
  elab_conf:Script_ir_translator_config.elab_config ->
  Alpha_context.context ->
  allow_forged:bool ->
  ('a, _) Script_typed_ir.ty ->
  Alpha_context.Script.node ->
  ('a * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tFor benchmarking purpose, we also export versions of the unparsing functions which don't call location stripping. These functions are not carbonated and should not be called directly from the protocol.
val parse_instr : 
  elab_conf:Script_ir_translator_config.elab_config ->
  tc_context ->
  Alpha_context.context ->
  Alpha_context.Script.node ->
  ('a, 's) Script_typed_ir.stack_ty ->
  (('a, 's) judgement * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tval parse_big_map_value_ty : 
  Alpha_context.context ->
  legacy:bool ->
  Alpha_context.Script.node ->
  (Script_typed_ir.ex_ty * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultparse_ty specialized for the right-hand side part of a big map type, i.e. the `value` in `big_map key value`.
val parse_packable_ty : 
  Alpha_context.context ->
  legacy:bool ->
  Alpha_context.Script.node ->
  (Script_typed_ir.ex_ty * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultval parse_passable_ty : 
  Alpha_context.context ->
  legacy:bool ->
  Alpha_context.Script.node ->
  (Script_typed_ir.ex_ty * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultval parse_comparable_ty : 
  Alpha_context.context ->
  Alpha_context.Script.node ->
  (ex_comparable_ty * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultval parse_parameter_ty_and_entrypoints : 
  Alpha_context.context ->
  legacy:bool ->
  Alpha_context.Script.node ->
  (ex_parameter_ty_and_entrypoints * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultval parse_view_input_ty : 
  Alpha_context.context ->
  stack_depth:int ->
  legacy:bool ->
  Alpha_context.Script.node ->
  (Script_typed_ir.ex_ty * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultval parse_view_output_ty : 
  Alpha_context.context ->
  stack_depth:int ->
  legacy:bool ->
  Alpha_context.Script.node ->
  (Script_typed_ir.ex_ty * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultval parse_view : 
  elab_conf:Script_ir_translator_config.elab_config ->
  Alpha_context.context ->
  ('storage, _) Script_typed_ir.ty ->
  Script_typed_ir.view ->
  ('storage typed_view * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tval parse_views : 
  elab_conf:Script_ir_translator_config.elab_config ->
  Alpha_context.context ->
  ('storage, _) Script_typed_ir.ty ->
  Script_typed_ir.view_map ->
  ('storage typed_view_map * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tval parse_any_ty : 
  Alpha_context.context ->
  legacy:bool ->
  Alpha_context.Script.node ->
  (Script_typed_ir.ex_ty * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultparse_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 ->
  (Script_typed_ir.ex_ty * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultWe 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.
val parse_toplevel : 
  Alpha_context.context ->
  legacy:bool ->
  Alpha_context.Script.expr ->
  (toplevel * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tval typecheck_code : 
  legacy:bool ->
  show_types:bool ->
  Alpha_context.context ->
  Alpha_context.Script.expr ->
  (Script_tc_errors.type_map * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tHigh-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 parse_storage : 
  elab_conf:Script_ir_translator_config.elab_config ->
  Alpha_context.context ->
  allow_forged:bool ->
  ('storage, _) Script_typed_ir.ty ->
  storage:Alpha_context.Script.lazy_expr ->
  ('storage * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tval parse_script : 
  elab_conf:Script_ir_translator_config.elab_config ->
  Alpha_context.context ->
  allow_forged_in_storage:bool ->
  Alpha_context.Script.t ->
  (ex_script * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tCombines parse_code and parse_storage
val parse_and_unparse_script_unaccounted : 
  Alpha_context.context ->
  legacy:bool ->
  allow_forged_in_storage:bool ->
  Script_ir_unparser.unparsing_mode ->
  normalize_types:bool ->
  Alpha_context.Script.t ->
  (Alpha_context.Script.t * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tval parse_contract_data : 
  Alpha_context.context ->
  Alpha_context.Script.location ->
  ('a, _) Script_typed_ir.ty ->
  Alpha_context.Destination.t ->
  entrypoint:Alpha_context.Entrypoint.t ->
  (Alpha_context.context * 'a Script_typed_ir.typed_contract)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tval parse_contract_for_script : 
  Alpha_context.context ->
  Alpha_context.Script.location ->
  ('a, _) Script_typed_ir.ty ->
  Alpha_context.Destination.t ->
  entrypoint:Alpha_context.Entrypoint.t ->
  (Alpha_context.context * 'a Script_typed_ir.typed_contract option)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.ttype 'a ex_ty_cstr = - | Ex_ty_cstr : {- ty : ('b, _) Script_typed_ir.ty;
- construct : 'b -> 'a;
- 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.tval list_entrypoints_uncarbonated : 
  ('t, _) Script_typed_ir.ty ->
  't Script_typed_ir.entrypoints ->
  Michelson_v1_primitives.prim list list
  * (Script_typed_ir.ex_ty * Alpha_context.Script.node)
      Alpha_context.Entrypoint.Map.tval pack_data : 
  Alpha_context.context ->
  ('a, _) Script_typed_ir.ty ->
  'a ->
  (bytes * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tval hash_comparable_data : 
  Alpha_context.context ->
  'a Script_typed_ir.comparable_ty ->
  'a ->
  (Script_expr_hash.t * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tval hash_data : 
  Alpha_context.context ->
  ('a, _) Script_typed_ir.ty ->
  'a ->
  (Script_expr_hash.t * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tval collect_lazy_storage : 
  Alpha_context.context ->
  ('a, _) Script_typed_ir.ty ->
  'a ->
  (lazy_storage_ids * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultTraverse the given type, producing a lazy_storage_ids for use with extract_lazy_storage_diff.
val extract_lazy_storage_diff : 
  Alpha_context.context ->
  Script_ir_unparser.unparsing_mode ->
  temporary:bool ->
  to_duplicate:lazy_storage_ids ->
  to_update:lazy_storage_ids ->
  ('a, _) Script_typed_ir.ty ->
  'a ->
  ('a * Alpha_context.Lazy_storage.diffs option * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresult
    Tezos_protocol_environment_alpha.Lwt.tProduce 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.
val get_single_sapling_state : 
  Alpha_context.context ->
  ('a, _) Script_typed_ir.ty ->
  'a ->
  (Alpha_context.Sapling.Id.t option * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultval code_size : 
  Alpha_context.context ->
  ('a, 'b) Script_typed_ir.lambda ->
  Script_typed_ir.view_map ->
  (Cache_memory_helpers.sint * Alpha_context.context)
    Tezos_protocol_environment_alpha.Error_monad.tzresultcode_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.
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.